Try fast search NHibernate

23 September 2009

Sharp Tests Ex 0.3.0 : fluent and lambda assertions for MsTests, NUnit and xUnit

#TestsEx 0.3.0 was released yesterday.


The first news is that #TestsEx is no more a “one-man-show”; Jason Diamond is now part of the team.

The second news is that the new syntax, based on lambda expression, is now available (similar to the one available in NUnitEx). You can see an example in the download page.

var var2 = 2;
2.Satisfy(a => var2 == a);
1.Satisfy(a => a == 1 || a != 0);

The mayor advantage of the “Satisfy syntax” is that it is pure C#; perhaps is less readable but you don’t need to know the name of an assertion and its “extensible limit” is the same you have in C#. Even if this feature is available and can be used right now, we are working to improve the failure message.

The breaking change

Perhaps this is the first time I’m happy to announce a breaking change. Starting from this release, to use #TestsEx extensions, you must specify the using clause.

using SharpTestsEx;

Why ? #TestsEx, now can be used with your preferred unit test framework.

We are supporting MsTests, NUnit and xUnit.

For MsTests

You must add the reference to SharpTestsEx.MSTest.dll in your test project.

For NUnit

You must add the reference to SharpTestsEx.NUnit.dll in your test project.

For xUnit

You must add the reference to SharpTestsEx.xUnit.dll in your test project.

For others

For others frameworks you can use SharpTestsEx.dll but, probably, you will see SharpTestsEx in the stack trace of the failure message in your test runner.

If you are working in various projects, using various unit tests frameworks, now you have one more reason to use #TestsEx.


Sharp Tests Extensions is a compendium of commons “extensible extensions” to work with your preferred unit test framework and not another test framework.

The Syntax overview is available here.

Happy testing!!


  1. Great work! I have been using the first version on nUnit, and my company is now stuck with MSTest.. love to use the same elegant syntax for both places now :)

    Love the "Satisfy Syntax"! Keep it going! :)

  2. New "sharptestsex" with "satisfy syntax"? It all depends on where you divide up the words... :)

  3. @DoniG
    For sure!!! LOL
    Non only useful but even funny.

  4. Any plans to support mbUnit out of the box?

  5. Sure. In theory it should be easy.
    To have an idea this is all we need to full support xUnit
    and this is all we need to full support NUnit

    btw you can actually use #TestsEx using SharpTestsEx.dll

    If you have time to try it with MbUnit we will be happy.

  6. I'm sorry, but how could you possibly want this over something like this:

    // Assert
    var2.ShouldBeExactly( 2 );

    Sheesh, this is technomasturbation!

  7. @Pedro
    Try to extend it, try to write it without know the assertion name, try to concatenate assertions over the same value under test.

    Btw nobody said you must use something.
    #TestsEx is not a substitution of your preferred test FX.

  8. Does SharpTestEx covers all the functionality provided by NUnitEx (and with the compatible syntax)?

    If so, should i stop using NUnitEx and start using SharpTestExt.

    What would you recommend? Did you change you existing tests that were writed with NUnitEx to make them use SharpTestEx.

  9. @Vansha
    Yes it does.

    I'll continue maintaining NUnitEx for new versions of NUnit.
    So far I have replaced NUnitEx with #TestsEx only in one prj.

  10. And for future projects you will use #TestEx, even if all tests will be writen for NUnit. Right?

    Thank you for great work!