
nunitex
IMPORTANT NOTES
SharpTestsEx is and will be the multi-purpose version of NUnitEx. You can use SharpTestsEx with NUnit, xUnit, MsTests , MbUnit and, in theory, with any other test framework.
NUnitEx
Set of constraints extensions to work on-top of NUnit. <wiki:gadget url="http://www.ohloh.net/p/320343/widgets/project_basic_stats.xml" height="220" border="1" />
Strongly typed Assertions few examples ``` true.Should().Be.True(); false.Should().Be.False();
const string somethig = "something"; somethig.Should().Contain("some"); somethig.Should().Not.Contain("also"); somethig.ToUpperInvariant().Should().Not.Contain("some");
somethig.Should() .StartWith("so") .And .EndWith("ing") .And .Contain("meth");
somethig.Should() .Not.StartWith("ing") .And .Not.EndWith("so") .And .Not.Contain("body");
var ints = new[] { 1, 2, 3 }; ints.Should().Have.SameSequenceAs(new[] { 1, 2, 3 }); ints.Should().Not.Have.SameSequenceAs(new[] { 3, 2, 1 }); ints.Should().Not.Be.Null(); ints.Should().Not.Be.Empty();
ints.Should() .Contain(2) .And .Not.Contain(4);
(new int[0]).Should().Be.Empty(); ```
Exceptions assertions
``` (new Action(() => new AClass(null))) .Should().Throw() .And .ValueOf.ParamName .Should().Be.EqualTo("obj");
(new Action(() => new MyClass(null)) .Should().Throw() .And .ValueOf.InnerExceptions() .OfType().First() .ParamName.Should().Be.EqualTo("obj");
new Action(() => new MyClass(null)) .Should().Throw() .And .ValueOf.InnerExceptions().Select(e => e.GetType()) .Should().Contain(typeof(ArgumentOutOfRangeException));
(new Action(() => new MyClass(null)) .Should().Throw() .And .ValueOf.InnerException .Should().Be.OfType() .And .ValueOf.Message .Should().Be.EqualTo("Null not allowed.");
```
Project Information
- License: GNU Lesser GPL
- 14 stars
- svn-based source control
Labels:
NUnit
TDD
Test
Extensions