Posts
1150
Comments
891
Trackbacks
1
Conditional code for Creating Unit Tests for both VSTS and Nunit

This allows you to create a single class that can be compiled in different projects to use unit tests in either VSTS or Nunit.  From Microsoft's Enterprise Library January 2006:

Where NUNIT is a defined constant in your project file.
#if !NUNIT
using Microsoft.VisualStudio.TestTools.UnitTesting;
#else
using NUnit.Framework;
using TestClass = NUnit.Framework.TestFixtureAttribute;
using TestMethod = NUnit.Framework.TestAttribute;
using TestInitialize = NUnit.Framework.SetUpAttribute;
using TestCleanup = NUnit.Framework.TearDownAttribute;
#endif
posted on Friday, August 25, 2006 10:31 AM Print
Comments
No comments posted yet.

Post Comment

Title *
Name *
Email
Url
Comment *  
Please add 3 and 4 and type the answer here: