How to convert NUnit Assert.AreEqual to fluent Assert.That syntax easily
Once upon a time it was declared that an Assert statement should have constraints given as AreEqual and AreNotEqual. Further it was declared that it should be written in the opposite way of how a developer will think, that is with the expected value first and the actual value last. Why this was made so, is still unclear.
And then we end up with tons of code like:
Assert.AreEqual(“Zulu”, zulu.Name);
Assert.AreEqual(“Z - Zulu”, zulu.Description);
Assert.AreEqual(FlagType.Signal, zulu.Sort);
Assert.AreEqual(0.7, zulu.AspectRatio);
A series of short recipes for VSTS, VISUAL STUDIO and NUnit
I have had a need to have more easy access to information on how to do certain stuff, and have some easy access to simple code blocks, or templates, I can copy/paste. A blog post is for me somewhat more extensive, and that format was not really suited for smaller notes. So I decided to write them down as “recipes”, which is a small post, larger than a post-it, but smaller than a full blown blog post.
WrapThat.System : Wrappers for system.io to simplify unit testing
Introduction
You have all seen it, you have all done it: Written code using the static methods from the System.IO namespace for handling directories and files. Or, you are maintaining legacy code where that usage is common in certain places. And now the code is huge, you have no unit tests, because unit testing classes that directly access the file system is just pain, and the cost of a rewrite is too big.