Project Description

UnitDriven is a multi-platform unit testing framework for the CLR. UnitDriven allows you to write a single test that will compile and run, synchronously or asynchronously in Silverlight, Windows Phone and .NET platforms.

Setup Tests for Silverlight or WP7

First, create a Silverlight or Windows Phone application and add a reference to UnitDriven.

private void Application_Startup(object sender, StartupEventArgs e)
{
    this.RootVisual = new UnitDriven.TestEngine(Assembly.GetExecutingAssembly());
}

Example Asynchronous Test With UnitDriven

[TestClass]
class ExampleTests : TestBase
{
    [TestMethod]
    [ExpectedException(typeof(InvalidOperationException))]
    public void ExpectedExceptionExample()
    {
        using (var context = GetContext())
        {
            BackgroundWorker worker = new BackgroundWorker();
            worker.DoWork += this.ThrowsAnException;
            worker.RunWorkerCompleted += (o, e) =>
            {
                context.Assert.Fail(e.Error);
            };

            worker.RunWorkerAsync();

            // When the context is disposed it will find the exception and re-throw it in .NET
            // and simply pass it back asynchronously in Silverlight.
        }
    }
}
See a more Detailed Example.

Developer Blogs

Contributors

Last edited Nov 16, 2010 at 2:13 AM by justinc, version 18