Monday, April 23, 2012

F#, MSTest, and FsUnit 1.1.0.0

I've been very busy with a few side projects that I plan to talk more about soon. Sadly, my blog has suffered due to these other activities, but I wanted to take a few minutes to talk about a new MSTest project template available on Visual Studio Gallery as well as some activity going on with FsUnit.

MSTest Project Template:

In the first week of March I released a new project template that helps in the creation of unit tests with MSTest and VS11. You can find it at http://visualstudiogallery.msdn.microsoft.com/51ebe64a-899b-4959-8c24-b0148ed6b264 or by searching for "fsharp mstest" in the Visual Studio Gallery online templates.

FsUnit:

FsUnit has also had a few enhancements.

1. Support for MsTest has been added for VS11 and made available through a new NuGet package named Fs30Unit.MsTest.

2. A few new assertions have been added for NUnit including NaN, instanceOfType, and unique.

3. FsUnit has long supported a function named "not". While this is a nice feature, the fact that it overwrites an F# operator is not ideal. Because of this, version 1.1.0.0 renames this function to not'. For the purpose of backward compatibility, you can open the module named FsUnitDepricated to make the "not" function available.

One last thing. If you're using FsUnit with NUnit, MbUnit, or xUnit in VS11 Beta, you will need to add binding redirects from previous versions of FSharp.Core to version 4.3.0.0. The easiest way to do this is to use the Add-BindingRedirect PowerShell cmdlet provided by NuGet (http://docs.nuget.org/docs/reference/package-manager-console-powershell-reference). Here are the steps:

1. After installing one of the FsUnit NuGet packages, create an App.config file (if one doesn't already exist).

2. In the NuGet Package Manager Console, run the following command "Add-BindingRedirect projectname" after replacing projectname with the name of your test project.