From e5f6cc69dafbaff8e3470077009fadf6008c5890 Mon Sep 17 00:00:00 2001 From: Marcello Lamonaca Date: Sat, 24 Apr 2021 13:26:22 +0200 Subject: [PATCH] Add notes un xUnit --- .NET/C#/Unit Testing.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.NET/C#/Unit Testing.md b/.NET/C#/Unit Testing.md index 3abf0f6..0159c0e 100644 --- a/.NET/C#/Unit Testing.md +++ b/.NET/C#/Unit Testing.md @@ -39,3 +39,28 @@ namespace Project.Tests [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) + +## 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(IEnumerable collection, Action action); + } + } +} +```