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
-
LIVE
NEWSMAX
1 month agoNEWSMAX2 LIVE | Real News for Real People
5,756 watching -
1:16:32
Game On!
14 hours ago $1.14 earnedBelichick DEMANDS NFL Change Super Bowl Trophy Name to HONOR Tom Brady
14.4K2 -
13:01
MichaelBisping
16 hours agoBISPING meets SHARA BULLET - 'One Eye Brothers!' | UFC Saudi Arabia (INTERVIEW)
10.9K1 -
9:46
Guns & Gadgets 2nd Amendment News
1 day agoNew Bill Would Destroy ATF's Gun Registry!
8.93K28 -
8:59
IsaacButterfield
1 day ago $0.87 earnedThis Needs To Be Stopped
5.99K7 -
11:48
Alabama Arsenal
1 day ago $0.52 earnedGenesis Gen 12 Deep Dive | Unleash The Power
7.34K4 -
38:57
PMG
16 hours ago $0.76 earnedHannah Faulkner and Brandon Tatum | BREAKING THE CHAINS: Exposing the Left’s Manipulation
12.4K3 -
46:26
State of the Second Podcast
17 hours agoATF tries to Silence FREE SPEECH? (ft. AmmoLand)
10.3K1 -
12:53
BIG NEM
13 hours agoI Became a Virginity Expert. The Numbers Will SHOCK You.
8.21K1 -
7:51
PerpetualHealthCo
21 hours agoW.H.O's In Charge?
6.63K4