Premium Only Content

Unit testing in C# .NET with MSTest & Moq
I show you how to unit test simple scenario's and more advanced scenario's using Moq to mock complex dependencies like Entity Framework Core's DbContext.
Once you get the hang of it, testing is a blast :)! Enjoy!
The source code can be found here: https://www.patreon.com/posts/unit-testing-in-88459377?utm_medium=clipboard_copy&utm_source=copyLink&utm_campaign=postshare_creator&utm_content=join_link
If you found this video helpful, like & subscribe, that means a lot to me!
00:00 Intro
01:50 Why to test?
03:18 Demo setup
04:20 New test project
06:20 Move business logic
08:35 New unit test
11:16 Mock dependencies
14:53 Arrange Act Assert
18:30 Happy / Unhappy paths
22:30 Test with database
25:20 InMemoryDatabase
29:10 Why Mocked Database
31:45 Source code
33:36 Understand Mocking
38:40 MockQueryable
45:20 Finalize demo
47:36 Recap
50:03 Testing IMO
52:48 Outro
#unittesting #testing #dotnet #csharp #webapi #serilog #logging #monitoring #api #webdevelopment #fullstack #fullstacksoftwareengineering #backend #docker #azure #containerization #devops #cloud #microsoft #linux #entityframework #identityframework #mssqlserver #mssql #cleanarchitecture #authentication #api #development #local #web #fullstack #webdevelopment #authorization #jwt #bearer #cqrs #mediatr #webapi #cors #http #stateless #webscraping #workers #migration #mstest #mock #mocktest
-
3:07
NAG Daily
15 hours agoYour Inner Dialogue w/ GreenMan
2.51K -
3:26
From Zero → Viral with AI
4 days ago $0.75 earnedAI Isn’t the Strategy — It’s the Tool | How AI Can Transform Political Campaigns
8.06K1 -
8:09
DropItLikeItsScott
14 hours ago $0.36 earnedHi Point HP-15 AR Pistol / Accuracy Test
2.17K1 -
52:59
CharLee Simons presents DO NOT TALK
5 days agoWTH is a BAD BUNNY?! Sam Anthony vs. Leftist Lunacy
3.16K11 -
14:00
Actual Justice Warrior
1 day agoBody Cam DESTROYS BLM Hoax
5.61K18 -
34:34
Steph & Kayls
19 hours ago $0.33 earnedHow We Separate Intimate Time : Personal Vs Adult Work | Ep.14
2.85K1 -
5:42
Buddy Brown
16 hours ago $1.65 earnedMessage to Chicago PD Taking Orders of TREASON Against ICE! | Buddy Brown
14.1K6 -
8:43
Michael Knowles
14 hours agoBad Bunny Demands You Learn Spanish Before Watching His Super Bowl Performance
13.6K35 -
15:23
Professor Nez
14 hours ago🚨VISIBLY SHAKING! Maxine Waters Just CONFESSED the Truth About the Shutdown
11K10 -
3:03:00
Side Scrollers Podcast
20 hours agoXbox is IN SHAMBLES + Player BANNED for MAGA Hat + H3H3 Lawsuit COOKS Reddit + More | Side Scrollers
51K8