A vanilla C# test suite project that includes an Assert class that provides assertions very similar to popular testing frameworks. The reason why this may be necessary is that the Express editions of Visual Studio do not allow for extensions. Most unit testing frameworks work on a plugin/extension basis. This project has no such requirement and can be used with Express.
- Drop
TestLibfolder into solution folder. - Add the
TestLibproject through Visual Studio. - Optionally: Add
TestLib.Testsproject through Visual Studio. This is a self-test of the assertion framework and can be used as a template. - Create new project from the test C# template or copy/paste
TestLib.Testsproject and modify appropriately. - Optionally: Add
[assembly: InternalsVisibleTo("TestLib.Tests")](replacing project name as appropriate) toAssemblyInfo.csin your project(s). - Start creating tests by affixing the vanilla .NET testing attributes of
TestClassandTestMethod.
- Open
Test.sln. - Switch build to
Releaseand compile theTestLibproject. - Optionally: Run the self-test of the assertion framework.
- Place binary in your solution somewhere and reference from your test project(s).
- Start creating tests by affixing the vanilla .NET testing attributes of
TestClassandTestMethod.
- VS2013: Usage of the combined err/out process spawner classes causes an
AppDomainUnloadedExceptionif there is also input involved, this appears to be a problem with the VS test runner and there appears to be no way to fix it (cf https://connect.microsoft.com/VisualStudio/feedback/details/797525/unexplained-appdomainunloadedexception-when-running-a-unit-test-on-tfs-build-server). This does not prevent the tests from passing successfully, it's only a message that shows up in the output.