Injecting a Logger - Dependency Injection Lab

Опубликовано: 04 Июль 2026
на канале: Coding with Jon and Mike
167
5

Jon and Mike decide to work through their friend Jeremy Clark's DI Lab that he prepped for VS Live! 2019. They add some characterization tests by using a variety of test double techniques.

Jeremy Clark: http://www.jeremybytes.com/Default.aspx
Lab Repository: https://github.com/jeremybytes/vslive...
ApprovalTests: https://approvaltests.com/

00:00 Intro to the exercise
03:16 Tour of the project
04:09 Already better than most
05:48 What to test first?
07:37 Run what's there
10:06 We gave up on getting the real logger to work in the tests
10:26 Finding out what VS Code can do
11:02 Seam for constructor injection
11:49 Starting with a hand rolled test doubles
12:19 Mike talks about test doubles even though Jon doesn't care
14:20 End of test double talk, let's use them
15:34 First test passes, we can use the code to tell us what the code does
16:44 Adding the other basic tests
20:50 Refactoring the tests, or not?
27:15 Introducing Moq
28:24 ApprovalTests by any other name
30:37 Using Moq
31:51 Times.Never
33:45 Testing bad records
36:02 How to apply DRY in tests
37:18 Using ApprovalTests for out "big" test
44:59 Wrap up
46:20 Did we catch em all?