using FluentAssertions; using FluentAssertions.Assertions; namespace Developpez.Dotnet.Tests { public static class TestExtensions { public static AndConstraint> BeNull(this NumericAssertions assertion) where T : struct { if (assertion.Subject != null) Execute.Verification.FailWith("Expected null value, but was not null"); return new AndConstraint>(assertion); } public static AndConstraint> NotBeNull(this NumericAssertions assertion) where T : struct { if (assertion.Subject == null) Execute.Verification.FailWith("Expected non-null value, but was null"); return new AndConstraint>(assertion); } public static AndConstraint> Be(this NumericAssertions assertion, T value) { if (assertion.Subject == null || assertion.Subject.CompareTo(value) != 0) Execute.Verification.FailWith("Expected {0}, but was {1}", value, assertion.Subject ?? "null"); return new AndConstraint>(assertion); } } }