Class NullReferenceBehaviorExpectation
Namespace: AutoFixture.Idioms
Assembly: AutoFixture.Idioms.dll
Encapsulates expectations about the behavior of a method or constructor when it's invoked with a null argument.
public class NullReferenceBehaviorExpectation : IBehaviorExpectationInheritance
object ← NullReferenceBehaviorExpectation
Implements
Inherited Members
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
The NullReferenceBehaviorExpectation class encapsulates the following expectation: when an action (such as a method call or constructor invocation) is performed with a null argument it should raise an `ArgumentNullException`. If this happens the expectation is verified. If no exception, or any other type of exception, is thrown the expectation isn't met.
Constructors
NullReferenceBehaviorExpectation()
public NullReferenceBehaviorExpectation()Methods
Verify(IGuardClauseCommand)
Verifies that the command behaves correct when invoked with a null argument.
public void Verify(IGuardClauseCommand command)Parameters
command IGuardClauseCommand
The command whose behavior must be examined.
Remarks
The Verify method attempts to invoke the command instance's
`Object)` with null. The expected
result is that this action throws an `ArgumentNullException` with proper parameter name,
in which case the expected behavior is considered verified. If any other exception is thrown, or
if no exception is thrown at all, the verification fails and an exception is thrown.
The behavior is only asserted if the command's `RequestedType` is nullable. In case of value types, no action is performed.