Search Wiki:


Things to remember:

  • Unit Test == visible static parameterless static method marked with [Conditional("TEST")].
    public static void Test() { ... }
  • Does not require any reference assembly, it reuses existing BCL APIs to specify unit tests:
MSTest YUnit
[TestClass] not needed
[TestMethod] Conditional("TEST")
[TestInitialize], ... not supported
Assert.IsTrue(...) Debug.Assert(...)
  • Test can be removed from the final product using the ConditionalAttribute.
  • Tests can be authored anywhere.
  • Tests are run through Team Test like any other unit tests.
  • PUnit walks all the assemblies that are referenced from any Test Project in your solution to find the tests.

How to get started?

  • Create a C# class library (say ClassLibrary),
  • Add the following class,
public class PUnitTest {
    public static void HelloWorld() {
  • Create a Test Project (say TestProject),
  • Add a reference of ClassLibrary to TestProject,
  • Open the Test View and refresh, you should see the HelloWorld test!

Last edited Aug 29 2008 at 6:21 PM  by peli, version 2
Page view tracker