Class GuardClauseAssertion
Namespace: AutoFixture.Idioms
Assembly: AutoFixture.Idioms.dll
Encapsulates a unit test that verifies that a method or constructor has appropriate Guard Clauses in place.
public class GuardClauseAssertion : IdiomaticAssertion, IIdiomaticAssertionInheritance
object ← IdiomaticAssertion ← GuardClauseAssertion
Implements
Inherited Members
IdiomaticAssertion.Verify(params Assembly[]), IdiomaticAssertion.Verify(IEnumerable<Assembly>), IdiomaticAssertion.Verify(Assembly), IdiomaticAssertion.Verify(params Type[]), IdiomaticAssertion.Verify(IEnumerable<Type>), IdiomaticAssertion.Verify(Type), IdiomaticAssertion.Verify(params MemberInfo[]), IdiomaticAssertion.Verify(IEnumerable<MemberInfo>), IdiomaticAssertion.Verify(MemberInfo), IdiomaticAssertion.Verify(params ConstructorInfo[]), IdiomaticAssertion.Verify(IEnumerable<ConstructorInfo>), IdiomaticAssertion.Verify(FieldInfo), IdiomaticAssertion.Verify(params FieldInfo[]), IdiomaticAssertion.Verify(IEnumerable<FieldInfo>), IdiomaticAssertion.Verify(ConstructorInfo), IdiomaticAssertion.Verify(params MethodInfo[]), IdiomaticAssertion.Verify(IEnumerable<MethodInfo>), IdiomaticAssertion.Verify(MethodInfo), IdiomaticAssertion.Verify(params PropertyInfo[]), IdiomaticAssertion.Verify(IEnumerable<PropertyInfo>), IdiomaticAssertion.Verify(PropertyInfo), object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Constructors
GuardClauseAssertion(ISpecimenBuilder)
Initializes a new instance of the GuardClauseAssertion class.
public GuardClauseAssertion(ISpecimenBuilder builder)Parameters
builder ISpecimenBuilder
A composer which can create instances required to implement the idiomatic unit test.
Remarks
builder will typically be a `Fixture` instance.
GuardClauseAssertion(ISpecimenBuilder, IBehaviorExpectation)
Initializes a new instance of the GuardClauseAssertion class.
public GuardClauseAssertion(ISpecimenBuilder builder, IBehaviorExpectation behaviorExpectation)Parameters
builder ISpecimenBuilder
A composer which can create instances required to implement the idiomatic unit test.
behaviorExpectation IBehaviorExpectation
A behavior expectation to override the default expectation.
Remarks
builder will typically be a `Fixture` instance.
Properties
BehaviorExpectation
Gets the behavior expectation.
public IBehaviorExpectation BehaviorExpectation { get; }Property Value
Remarks
GuardClauseAssertion contains an appropriate default implementation of `IBehaviorExpectation`, but a custom behavior can also be supplied via one of the constructor overloads. In any case, this property exposes the behavior expectation.
See Also
Builder
Gets the builder supplied via the constructor.
public ISpecimenBuilder Builder { get; }Property Value
ISpecimenBuilder
Methods
Verify(ConstructorInfo)
Verifies that a constructor has appropriate Guard Clauses in place.
public override void Verify(ConstructorInfo constructorInfo)Parameters
constructorInfo ConstructorInfo
The constructor.
Remarks
Exactly which Guard Clauses are verified is defined by `BehaviorExpectation`.
Verify(MethodInfo)
Verifies that a method has appropriate Guard Clauses in place.
public override void Verify(MethodInfo methodInfo)Parameters
methodInfo MethodInfo
The method.
Remarks
Exactly which Guard Clauses are verified is defined by `BehaviorExpectation`.
Verify(PropertyInfo)
Verifies that a property has appropriate Guard Clauses in place.
public override void Verify(PropertyInfo propertyInfo)Parameters
propertyInfo PropertyInfo
The property.
Remarks
Exactly which Guard Clauses are verified is defined by `BehaviorExpectation`.