Obligatory Unit Testing Post

Any developer worth his salt well tell you that unit testing is sweet. In fact unit tested code will simply help you sleep better, it’s that good. Sometimes, though, its easy to get bogged down in a project’s deadlines and skip the testing altogether. To avoid this I try to use tools that make the testing portion as easy as possible. Two of the best tools that I’ve found for .NET unit testing are XUnit and Moq, both available through nuget. XUnit and Moq are a powerful combination. XUnit is, in my opinion, the friendliest testing framework for .NET (for Continue reading Obligatory Unit Testing Post

Creating a Safer Guid

Guids (Globally Unique Identifers) are great. They are very useful when uniqueness is important, maybe for identification later on. They are fairly efficient to create and are even human readable. So yeah, Guids are pretty great… except when they aren’t. A common use case for a Guid (for me at least) is to receive it as a set of characters and then convert it to an actual Guid (in C#). This usually looks like this: public void CallWithGuidAsString(string guid) { Guid newGuid = new Guid(guid); // Do stuff with guid. } The issue with this is that it is not Continue reading Creating a Safer Guid