Skip to content

Instantly share code, notes, and snippets.

View PedroAvila's full-sized avatar

Pedro Ávila PedroAvila

View GitHub Profile
@PedroAvila
PedroAvila / XUnitAsserts.cs
Created November 9, 2024 22:21 — forked from jonesandy/XUnitAsserts.cs
A cheat sheet of Asserts for xUnit.net in C#
/*
STRINGS
*/
Assert.Equal(expectedString, actualString);
Assert.StartsWith(expectedString, stringToCheck);
Assert.EndsWith(expectedString, stringToCheck);
// Some can also take optional params
Assert.Equal(expectedString, actualString, ignoreCase: true);
Assert.StartsWith(expectedString, stringToCheck, StringComparison.OrdinalIgnoreCase);