You want to write a test for your code. The IsPrime function should return true when given an input of 2. There's just one problem: C# doesn't offer a keyword that says "this thing should happen". So how will you record the fact that the test should fail or not depending on some condition?
Category: Test Frameworks
Unit Test Frameworks in C#, Part Three: Data-Driven Tests
The first post in this series described the three major testing frameworks in .NET: MSTest, NUnit, and xUnit. The second post described how to get started and declare tests in each of them. Here I'll be discussing data-driven tests. Motivation Suppose you are writing a function to determine the sum of two integers. Your function … Continue reading Unit Test Frameworks in C#, Part Three: Data-Driven Tests
Unit Test Frameworks in C#, Part Two: Declaring and Structuring Tests
The first post in this series described the three major testing frameworks in .NET: MSTest, NUnit, and xUnit. Here I'll be describing how to get started writing actual tests in each of them. Marking a class as containing a test Some test frameworks require you to mark a class as a test container. MSTest A … Continue reading Unit Test Frameworks in C#, Part Two: Declaring and Structuring Tests
Unit Test Frameworks in C#, Part One: The Basics
This begins a series of posts in which I will compare the major testing frameworks available for unit testing (as opposed to UI testing frameworks like Selenium or Cucumber) available for the .NET Framework. The major players here are MSTest, NUnit, and Xunit. There are, of course, ...