Asynchronous tests in VSUTF, NUnit, xUnit.NET, MbUnit vs SUTF?

Silverlight Unit Test The platform has the [AsynchronousAttribute] attribute, which causes the tests to end only when EnqueueTestComplete () is called. This allows you to use a simple way to write tests that need to wait for an event to finish. Now Iā€™m trying to choose from the very beginning the most suitable variant of Unit Test, which looks the most popular - VSUTF, NUnit, xUnit.NET, MbUnit, and I was wondering how you will conduct asynchronous testing using these frameworks

I suppose I can release some custom code that Monitor.Wait or ResetEventWaitOne will do and call it at the end of the test method, and then execute Pulse / Set when the test is finished, but I looked, is an existing general / inline solution .

This is an example of how this is done in SUT (from http://smartypantscoding.com/a-cheat-sheet-for-unit-testing-silverlight-apps-on-windows-phone-7 ).

[TestClass] public class AsyncTests : SilverlightTest { [Asynchronous] [TestMethod] public void AsyncAppendStringTest() { var appendStrings = new List<string>() { "hello", "there" }; StringJoiner.AsyncAppendStringsWithDashes(appendStrings, (returnString) => { Assert.IsTrue(string.Compare(returnString, "hello-there") == 0); EnqueueTestComplete(); }); } } 
+7
source share
2 answers

Visual Studio now supports tests that have the async Task signature, and tests end when the async method completes.

+1
source

Christopher Bennage has an interesting approach to this, inspired by Caliburn Micro:

http://devlicio.us/blogs/christopher_bennage/archive/2011/01/17/improving-asynchronous-tests-for-silverlight.aspx

+1
source

All Articles