Class DataAnnotationsSupportNode

Namespace: AutoFixture.DataAnnotations
Assembly: AutoFixture.dll

A marker class, used to explicitly identify builders related to the data annotation handling.

public class DataAnnotationsSupportNode : ISpecimenBuilderNode, ISpecimenBuilder, IEnumerable<ISpecimenBuilder>, IEnumerable

Inheritance

objectDataAnnotationsSupportNode

Implements

ISpecimenBuilderNode, ISpecimenBuilder, IEnumerable<ISpecimenBuilder>, IEnumerable

Inherited Members

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

Extension Methods

SpecimenFactory.Create<T>(ISpecimenBuilder), SpecimenFactory.CreateMany<T>(ISpecimenBuilder), SpecimenFactory.CreateMany<T>(ISpecimenBuilder, int), SpecimenCommand.Do<T>(ISpecimenBuilder, Action<T>), SpecimenCommand.Do<T1, T2>(ISpecimenBuilder, Action<T1, T2>), SpecimenCommand.Do<T1, T2, T3>(ISpecimenBuilder, Action<T1, T2, T3>), SpecimenCommand.Do<T1, T2, T3, T4>(ISpecimenBuilder, Action<T1, T2, T3, T4>), SpecimenQuery.Get<T, TResult>(ISpecimenBuilder, Func<T, TResult>), SpecimenQuery.Get<T1, T2, TResult>(ISpecimenBuilder, Func<T1, T2, TResult>), SpecimenQuery.Get<T1, T2, T3, TResult>(ISpecimenBuilder, Func<T1, T2, T3, TResult>), SpecimenQuery.Get<T1, T2, T3, T4, TResult>(ISpecimenBuilder, Func<T1, T2, T3, T4, TResult>), SpecimenBuilderNode.GraphEquals(ISpecimenBuilderNode, ISpecimenBuilderNode), SpecimenBuilderNode.GraphEquals(ISpecimenBuilderNode, ISpecimenBuilderNode, IEqualityComparer<ISpecimenBuilder>), CustomizationExtensions.ToCustomization(ISpecimenBuilder)

Remarks

The only purpose of this class is to act as an easily identifiable container. This makes it easier to find the collection of data annotation related nodes in the customization list.

Constructors

DataAnnotationsSupportNode(ISpecimenBuilder)

Initializes a new instance of DataAnnotationsSupportNode.

public DataAnnotationsSupportNode(ISpecimenBuilder builder)

Parameters

builder ISpecimenBuilder

Builder that handles all the data annotation related requests.

Properties

Builder

Builder used to handle the incoming requests.

public ISpecimenBuilder Builder { get; }

Property Value

ISpecimenBuilder

Methods

Compose(IEnumerable<ISpecimenBuilder>)

Composes the supplied builders.

public ISpecimenBuilderNode Compose(IEnumerable<ISpecimenBuilder> builders)

Parameters

builders IEnumerable<ISpecimenBuilder>

The builders to compose.

Returns

ISpecimenBuilderNode

A ISpecimenBuilderNode instance.

Remarks

Note to implementers:

The intent of this method is to compose the supplied builders into a new instance of the type implementing `ISpecimenBuilderNode`. Thus, the concrete return type is expected to the same type as the type implementing the method. However, it is not considered a failure to deviate from this idiom - it would just not be a mainstream implementation.

The returned instance is normally expected to contain the builders supplied as an argument, but again this is not strictly required. The implementation may decide to filter the sequence or add to it during composition.

Create(object, ISpecimenContext)

Creates a new specimen based on a request.

public object Create(object request, ISpecimenContext context)

Parameters

request object

The request that describes what to create.

context ISpecimenContext

A context that can be used to create other specimens.

Returns

object

The requested specimen if possible; otherwise a NoSpecimen instance.

Remarks

The request can be any object, but will often be a `Type` or other `MemberInfo` instances.

Note to implementers: Implementations are expected to return a `NoSpecimen` instance if they can't satisfy the request.

GetEnumerator()

public IEnumerator<ISpecimenBuilder> GetEnumerator()

Returns

IEnumerator<ISpecimenBuilder>