You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A null object is considered not equal to any type:
objectsomeObject=null;// Does throw with fluentassertions, but not with aweXpectawaitExpect.That(someObject).IsNot(typeof(DateTime));// orstringaString=null;// Does throw with fluentassertions, but not with aweXpectawaitExpect.That(aString).IsNotExactly(typeof(string));
When checking "contains at most" against null, it throws:
stringactual=null;// Does not throw with fluentassertions, but does with aweXpectExpect.That(actual).Contains(expectedSubstring).AtMost(1.Times());Expect.That(actual).Contains(expectedSubstring).LessThan(1.Times());
varcollection=newobject[]{typeof(int),2,typeof(int)};collection.Should().AllBeAssignableTo<int>();// Succeeds with fluentassertionsawaitExpect.That(collection).All().Are<int>();// Fails with aweXpect
DateTime with different Kind is considered different in aweXpect
varactual=newDateTime(2025,1,1,0,0,0,DateTimeKind.Local);varexpected=newDateTime(2025,1,1,0,0,0,DateTimeKind.Utc);actual.Should().Be(expected);// Succeeds with fluentassertionsawaitExpect.That(actual).IsEqualTo(expected);// Fails with aweXpect
automatic flattening of AggregateException:
Func<Task>act=()=>thrownewAggregateException(newArgumentException("It is nested within an `AggregateException`"));act.Should().Throw<ArgumentException>();// Succeeds with fluentassertionsawaitExpect.That(act).Throws<ArgumentException>();// Fails with aweXpect
BeInRange for numbers throws an XUnitException instead of ArgumentException when minimum or maximum is NaN.
Same for IsEqualTo("").AsWildcard() (which throws an ArgumentException on fluentassertions)
nullobject is considered not equal to any type:The same holds for e.g.
IsNotBetween:When checking "contains at most" against null, it throws:
All().Bedoes not mix type and instances (see AllBeAssignableTo behaving not like foreach BeAssignableTo fluentassertions/fluentassertions#1006)DateTimewith different Kind is considered different in aweXpectautomatic flattening of
AggregateException:BeInRangefor numbers throws anXUnitExceptioninstead ofArgumentExceptionwhen minimum or maximum is NaN.Same for
IsEqualTo("").AsWildcard()(which throws anArgumentExceptionon fluentassertions)