I am trying to use the Fluent Assertions ShouldBeNull() extension method to assert that my instance is indeed null.
Result.ShouldBeNull();
Clearly, this throws an exception because I cannot call the extension on a null instance.
System.NullReferenceException
How do I use Fluent Assertions properly to make this assertion?
Extension methods can be called on objects that are
null
.See for example http://bradwilson.typepad.com/blog/2008/01/c-30-extension.html
Think of extension methods not as instance methods, but static methods that take the object (
Result
in your case) as a first parameter.