Class AutoNSubstituteCustomization

Namespace: AutoFixture.AutoNSubstitute
Assembly: AutoFixture.AutoNSubstitute.dll

Enables auto-mocking with NSubstitute.

public class AutoNSubstituteCustomization : ICustomization

Inheritance

objectAutoNSubstituteCustomization

Derived

AutoConfiguredNSubstituteCustomization

Implements

ICustomization

Inherited Members

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Remarks

NOTICE! You can assign the customization properties to tweak the features you would like to enable. See example.

new AutoNSubstituteCustomization { ConfigureMembers = true }

Constructors

AutoNSubstituteCustomization()

Initializes a new instance of the AutoNSubstituteCustomization class.

        <p>
        NOTICE! You can assign the customization properties to tweak the features you would like to enable. Example:
        <br />
        <pre><code class="lang-csharp">new AutoNSubstituteCustomization { ConfigureMembers = true }</code></pre>
        </p>
public AutoNSubstituteCustomization()

AutoNSubstituteCustomization(ISpecimenBuilder)

Initializes a new instance of the AutoNSubstituteCustomization class.

[Obsolete("This constructor is obsolete and will be removed in a future version of the product. Please use the AutoNSubstituteCustomization() overload (without arguments) instead and set the Relay property.")]
public AutoNSubstituteCustomization(ISpecimenBuilder relay)

Parameters

relay ISpecimenBuilder

Properties

Builder

Gets the builder that will be added to ResidueCollectors when IFixture) is invoked.

[Obsolete("This property is obsolete - use the Relay property instead.")]
public ISpecimenBuilder Builder { get; }

Property Value

ISpecimenBuilder

ConfigureMembers

Specifies whether members of a substitute will be automatically configured to retrieve the return values from a fixture.

public bool ConfigureMembers { get; set; }

Property Value

bool

GenerateDelegates

If value is true, delegate requests are intercepted and created by NSubstitute. Otherwise, if value is false, delegates are created by the AutoFixture kernel.

public bool GenerateDelegates { get; set; }

Property Value

bool

Relay

Gets or sets the relay that will be added to ResidueCollectors when IFixture) is invoked.

public ISpecimenBuilder Relay { get; set; }

Property Value

ISpecimenBuilder

Methods

Customize(IFixture)

Customizes an IFixture to enable auto-mocking with NSubstitute.

public void Customize(IFixture fixture)

Parameters

fixture IFixture