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
-
5:32
Rethinking the Dollar
6 hours agoHolding 0.001 Bitcoin Could Make You a Millionaire – Here’s Why You’re the Elite
2.5K5 -
14:23
Degenerate Jay
7 hours ago $0.05 earnedThe Arkham Batman Is Alive - The Suicide Squad Game Is Dead
1.95K -
1:06:50
PMG
20 hours ago $0.61 earned"Never trust a government that leads you into the apocalypse"
9.5K2 -
1:05:15
In The Litter Box w/ Jewels & Catturd
23 hours agoExternal Revenue Service | In the Litter Box w/ Jewels & Catturd – Ep. 720 – 1/15/2025
45.8K18 -
5:55:09
Benny Johnson
9 hours ago🚨Confirmation Hearings LIVE Right NOW | Pam Bondi, Rubio, John Ratcliffe & More| Deep State PANIC
195K334 -
6:04:07
Barry Cunningham
23 hours agoWATCH LIVE: Pam Bondi Attorney General Confirmation Hearing For w/ Nancy Mace Interview
39.9K21 -
6:15:44
Robert Gouveia
11 hours agoPam Bondi Confirmation Hearing LIVE! Trump's Nominee to FIX Corrupt DOJ as Attorney General
64.2K26 -
1:57:41
The Quartering
5 hours agoTrump Just FREED Hostages, Pam Bondi Hearing, TikTok To SHUTDOWN, Bill Burr Gets Woke, LA Fires
64.6K43 -
1:12:39
Savanah Hernandez
3 hours agoLA Fire Dept withheld 1,000 firefighters ahead of the Palisades Fire
31.8K19 -
1:38:37
Mally_Mouse
4 hours agoLet's Yap About It - LIVE!
35.6K1