There is a reason why Unit Testing is the bottom layer in the testing pyramid. You can only build a solid testing suite on a robust foundation. Nothing is more reassuring when working on a codebase than knowing that if you accidentally break something, a test will alert you, saving you hundreds to thousands or even hundreds of thousands of dollars in potential customer impact. In this course, Nick will teach you how to write modern unit tests for your code bases so you are always confident in change. Oh, and if you don't know what the testing pyramid is, don't worry. You will after you take this course.
Different types of testing
What is unit testing and why it's important?
The testing pyramid
Why should you write unit tests?
The 3 core unit testing concepts
Writing your first unit test
Structuring your solution
Naming in unit tests
Arrange, Act, Assert
xUnit's test execution model
Test Setup and Teardown
Your turn to practice (Project source under the video)
My answer to the exercise
Writing fluent assertions
Testing methods that throw Exceptions
Testing for raised events
Testing private methods (members)
Testing internal methods (members)
The problem with dependencies
Dependency injection to the rescue
What are fakes?
What is mocking?
Moq vs NSubstitute
The project we will be adding unit tests to
The scope of our testing
Testing the application layer
Exercise: Testing the rest of the application layer (Project source under the video)
Exercise answer: Testing the rest of the application layer
But was all that necessary?
Testing the data layer
Testing the API layer
Exercise: Testing the rest of the API layer (Project source under the video)
Exercise answer: Testing the rest of the API layer
Observing the default test execution behavior
The Class Fixture
The Collection Fixture
Running test in parallel
Setting test execution timeouts
Testing Date and Time
What is code coverage?
Measuring code coverage
Nick Chapsas is a .NET & C# content creator, educator and a Microsoft MVP for Developer Technologies with years of experience in Software Engineering and Engineering Management.
He has worked for some of the biggest companies in the world, building systems that served millions of users and tens of thousands of requests per second.
Nick creates free content on YouTube and is the host of the Keep Coding Podcast.More courses by Nick Chapsas