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...
Unit Test Frameworks in C#, Part Four: Basic Assertions
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?
Agile Myths, Part Two
Scrum is a framework for developing, delivering, and sustaining complex products. That's all it is. It doesn't have to be software. It doesn't tell you to do TDD or how to set up your dev environment or what is the role of manual testing or QA. It doesn't tell you whether...
Agile Myths, Part One
I want to address some common misconceptions about Agile. We've all been told to "just be more agile". But what does that mean? What can we do about it? And how can we ensure that we derive the appropriate value from our "agile processes", whatever that means? I'll look at those questions...
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, ...
C# Shenanigans, Part One: A Memory Leak
Consider this console application. Let's walk through it. Nothing seems too awful. It starts by allocating a 1GB byte array and filling it with random bytes. It then traverses the byte array looking for the mode: the byte that occurs most often. Once it finds that, it prints the result out to the console (let's … Continue reading C# Shenanigans, Part One: A Memory Leak
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