xUnit.net is a free, open source, community-focused unit testing tool for the .NET Framework. Install xunit
from Nuget as version 2.4.1
.
U_I_E signatures are Unit of work
, inital condition
and expected result
.
Fact
1 | [ ] |
Other asserts
1 | Assert.Contains(collection, x => x.SweetProp == "Foo"); |
Theory - Inline Data
1 | [ ] |
Theory - Member Data
1 | public static IEnumerable<object[]> FooTestData() |
Shared Context between Tests
xUnit doesnt have explicit [SetUp]
and [TearDown]
annotations like NUnit, instead they say you must use a Constructor and Dispose.
1 | public class StackTests : IDisposable |
Exceptions
Verifies that the exact exception is thrown (and not a derived exception type). Returns the exception that was thrown, when successful.
1 | // Act |