Unit Testing 201: Mastering C# Unit Testing with Real-world Examples

$10
0 ratings

Learn how to write readable and maintainable unit tests in C# by refactoring real code examples.

πŸ‘€ About this course

You've learned the basics of unit testing in C#, but you still struggle with writing tests that are easy to read and maintain.

You've seen too many online tutorials testing a Calculator class, but you want to learn how to test real code. Code with dependencies, validations, and edge cases. Code that looks like the code you find every day at work.

That's why I created this course.

No more unit testing the Add() method of a Calculator class.

In this course, let's refactor some real unit tests to make them more readable and maintainable. Although I changed names, classes, and methods to avoid disclosing code from past clients and employers, these are the tests I had to work with as a software engineer.

You will learn how to transform messy and convoluted tests into readable and maintainable tests using proven principles and methods.

πŸ‘¨β€πŸ« Who is this course for?

This course is for you if you are:

  • A C# developer who wants to level up your unit testing skills and write better tests
  • A C# developer who is tired of boring and unrealistic tutorials and wants to learn from real code examples

After you follow this course, you will be able to:

  • Use builder methods to simplify your tests
  • Write tests for multiple test values to make your tests more maintainable
  • Choose good names and use simple test values to make your tests easier to follow
  • Write domain-specific assertion methods to have more readable tests

This is not an introductory course on unit testing. You should have some basic knowledge of writing unit tests with a testing framework like MSTest, a mocking library like Moq, and the Arrange/Act/Assert pattern.

If you're new to unit testing, check out my Unit Testing 101 ebook first. It will teach you the fundamentals of unit testing in C#.

πŸ“¦ What is inside?

In this course, you will get access to:

  • Eight lessons that cover different best practices for unit testing
  • More than ten unit tests that show real code examples that need refactoring
  • Four exercises that challenge you to apply what you learned and refactor a unit test on your own
  • A checklist that summarizes the best practices from the course

These are the modules and lessons inside:

  1. Testing AccountController............................4m45s
    • Use Builder Methods
    • Test IOptions Interface
    • Make Test Values Obvious
    • (Optional) Check for Missing Configuration Values Inside Constructors
  2. Testing PaymentRequestValidator...............3m40s
    • Use Parameterized Tests
    • Use FluentValidation Helpers
    • Use Parameterized Tests Insted of Loops
  3. Testing PaymentService.................................4m35s
    • Test a Single Concerned Per Test
    • Test Exception Messages
  4. Testing PayoutService....................................7m17s
    • Visually Structure Tests
    • (Optional) Use Fakes in Unit Testing
    • (Optional) Create Fakes With Moq
    • Use TypeBuilder
    • Avoid Overspecification
  5. Testing DictionaryExtensions.......................7m28s
    • Use Simple Test Values
    • Exercise: Refactor a Test That Merges Dictionaries
  6. Testing SendEmailCommandHandler.........10m26s
    • Test Public Behavior
    • Create a Custom Verify Method
    • Exercise: Refactor a Test That Stores an Email With Duplicated Addresses
  7. Testing UpdateStatusCommandHandler..12m11s
    • Avoid Hidden Assumptions
    • Exercise: Refactor a Test That Updates an Email Status
  8. Testing ImportGuestsService.......................4m46s
    • Use Object Mothers
    • Exercise: Refactor a Test That Uploads Guests

πŸš€ Join "Unit Testing 201"!

If you want to write readable and maintainable unit tests in C# by refactoring real code examples, this course is for you.

Don't miss this chance to master unit testing in C# with real code examples.

Click the "I Want This!" button below and join "Unit Testing 201" today.

I want this!
Watch link provided after purchase

30-Day Money Back Guarantee

If you're not satisfied with the course, or it's not what you expected, reply to the download email within 30 days of purchase. You'll get a full refund, no questions asked.

Last updated Apr 4, 2024

Modules
8
Video Lessons
16
Text Lessons
3
Unit Tests
+10
Exercises
4
Checklists
1
Videos
59m
Copy product URL
$10

Unit Testing 201: Mastering C# Unit Testing with Real-world Examples

0 ratings
I want this!