mirror of
https://github.com/m-lamonaca/dev-notes.git
synced 2025-04-07 03:16:41 +00:00
Add notes un xUnit
This commit is contained in:
parent
f88b29c32d
commit
e5f6cc69da
1 changed files with 25 additions and 0 deletions
|
@ -39,3 +39,28 @@ namespace Project.Tests
|
||||||
|
|
||||||
[UnitTest Overloaded Methods](https://stackoverflow.com/a/5666591/8319610)
|
[UnitTest Overloaded Methods](https://stackoverflow.com/a/5666591/8319610)
|
||||||
[Naming standards for unit tests](https://osherove.com/blog/2005/4/3/naming-standards-for-unit-tests.html)
|
[Naming standards for unit tests](https://osherove.com/blog/2005/4/3/naming-standards-for-unit-tests.html)
|
||||||
|
|
||||||
|
## xUnit
|
||||||
|
|
||||||
|
```cs
|
||||||
|
using System;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Project.Tests
|
||||||
|
{
|
||||||
|
public class ClassTest
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void TestMethod()
|
||||||
|
{
|
||||||
|
Assert.Equal(expected, actual); // works on collections
|
||||||
|
Assert.True(bool);
|
||||||
|
Assert.False(bool);
|
||||||
|
Assert.NotNull(nullable);
|
||||||
|
|
||||||
|
// Verifies that all items in the collection pass when executed against action
|
||||||
|
Assert.All<T>(IEnumerable<T> collection, Action<T> action);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
Loading…
Add table
Reference in a new issue