C# Unit Test Tutorial

The goal of Unit Testing is to write test code that tests production code. Unit Testing can be an amazing driver of quality or an expensive epic fail. Here are some best practices to make sure it the former, a driver of quality, instead of the latter, an epic fail.

This is going to be a work in progress and I will post articles as I write them…

C# Unit Testing – Basic

  1. What is a Unit Test?
  2. C# Unit Test Best Practices and Guidelines
  3. Unit Testing with Parameter Value Coverage (PVC)
    1. Parameter Value Coverage by Type
  4. Row Tests or Paramerterized Tests

C# Unit Testing – Advanced

  1. Why Interface-based design leads to good Unit Tests?
  2. What is Mocking and how do you Mock in C# Unit Tests?
  3. Unit Testing code that touches the system
  4. Unit testing calls to complex extension methods
  5. Hidden Cyclomatic Complexity due to Parameter Value Coverage

C# Unit Testing – Mocking Libraries

  1. How to mock an Entity Framework DbContext and its DbSet properties (EF 6)

C# Unit Test Examples

  1. How to write your first Unit Test with Visual Studio
  2. Unit Testing with a fake implementation of an Interface
  3. Unit Testing Registry access with RhinoMocks and SystemWrapper
  4. Unit Testing File IO with RhinoMocks and SystemWrapper
  5. Better unit tests in C#

Mocking Frameworks

NMock2

  1. Beginning Unit Testing Tutorial in C# with NUnit (Part 1)
  2. Beginning Unit Testing Tutorial in C# with NUnit (Part 2)
  3. How to Mock an internal interface with NMock2?

C# Unit Test Projects

  1. Unit Test Stub Code Generator for Covering Arrays
Other References to learn Unit Testing

Comments are closed.