Class NumericSequencePerTypeCustomization

Namespace: AutoFixture
Assembly: AutoFixture.dll

A customization that enables numeric specimens to be unique within a specific numeric Type.

public class NumericSequencePerTypeCustomization : ICustomization

Inheritance

objectNumericSequencePerTypeCustomization

Implements

ICustomization

Inherited Members

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

Remarks

When this customization is added to an `IFixture` instance, requests for numeric specimens will be satisfied by returning numbers from a `Type` specific sequence.

This customization reproduces the generation strategy for numeric specimens used in AutoFixture up to version 2.1.

<example>
var fixture = new Fixture();
fixture.Customize(new NumericSequencePerTypeCustomization());

Console.WriteLine("Byte specimen is {0}", fixture.Create<byte>()); Console.WriteLine("Int32 specimen is {0}", fixture.Create<int>()); Console.WriteLine("Single specimen is {0}", fixture.Create<float>());

// The output of this program will be: // Byte specimen is 1 // Int32 specimen is 1 // Single specimen is 1

</example>

Constructors

NumericSequencePerTypeCustomization()

public NumericSequencePerTypeCustomization()

Methods

Customize(IFixture)

Customizes the specified fixture by adding the Type specific numeric sequence generators.

public void Customize(IFixture fixture)

Parameters

fixture IFixture

The fixture to customize.