FluentAssertions 1.7.1, net35 version.
Type type = GetNullType();
type.Should().Be(null);
throws NullReferenceException if type is null:
System.NullReferenceException : Object reference not set to an instance of an object.
Stack Trace:
TypeAssertions.GetFailureMessageIfTypesAreDifferent(Type actual, Type expected)
TypeAssertions.Be(Type expected, String reason, Object[] reasonArgs)
TypeAssertions.Be(Type expected)
...
A valid workaround:
Object type = GetNullType();
type.Should().Be(null); // or type.Should().BeNull();
Asides from the unexpected exception, I think TypeAssertions should provide a BeNull method also.
Comments: Was already fixed in 2.0.0
Type type = GetNullType();
type.Should().Be(null);
throws NullReferenceException if type is null:
System.NullReferenceException : Object reference not set to an instance of an object.
Stack Trace:
TypeAssertions.GetFailureMessageIfTypesAreDifferent(Type actual, Type expected)
TypeAssertions.Be(Type expected, String reason, Object[] reasonArgs)
TypeAssertions.Be(Type expected)
...
A valid workaround:
Object type = GetNullType();
type.Should().Be(null); // or type.Should().BeNull();
Asides from the unexpected exception, I think TypeAssertions should provide a BeNull method also.
Comments: Was already fixed in 2.0.0