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?
Tag: Testing
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, ...
Microbenchmarking and the Importance of Being Thorough
Some time ago at work, I ran across code resembling the following.
Anyway, traditionally C# developers have had two ways of solving the "I want a reference to my object as an X
but I also want to handle the case where my object is not an X
" situation....
Adventures of an Open Source Rookie: Everything’s Broken and It’s All My Fault
Somewhere, there is a mother baking cookies. Her young son sees the busy-ness and productivity of the kitchen (to say nothing of the aromas) and wants to help. He learns that cookies are coming, and henceforth no force of man nor nature can keep him away from the kitchen. So she lets him. Only...