I personally don't like the idea of mixing two frameworks like it's mentioned in the article you are referring to.
A possible condition to make your unit test run under both test frameworks could be that you do not want or can not install Visual Studio on your continuous integration server.
Just for clarification, MSTest is not the Visual Studio Unit Testing Framework defined in the Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
assembly.
To be able to let your unit test run under both frameworks you would need to define a build constant (here NUNIT
) and with the help of preprocessor directives and namespace aliases you would end up with a snippet like this:
#if !NUNIT
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Category = Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute;
#else
using NUnit.Framework;
using TestInitialize = NUnit.Framework.SetUpAttribute;
using TestContext = System.Object;
using TestProperty = NUnit.Framework.PropertyAttribute;
using TestClass = NUnit.Framework.TestFixtureAttribute;
using TestMethod = NUnit.Framework.TestAttribute;
using TestCleanup = NUnit.Framework.TearDownAttribute;
#endif
I believe I came across this idea first through this MSDN Magazine article. Another worthwhile blog post covering this topic would be:
To your last question: The Fluent Assertions project seems to be a good library. I do not see any real reasons why you shouldn't use it if you like the fluent style of it.