Class SingletonSpecimenBuilderNodeStackAdapterCollection
A collection of ISpecimenBuilderTransformation instances, which can be used to produce a stack of singleton ISpecimenBuilderNode instances at the root of any ISpecimenBuilderNode graph.
Inheritance
Implements
Inherited Members
Namespace: AutoFixture
Assembly: AutoFixture.dll
Syntax
public class SingletonSpecimenBuilderNodeStackAdapterCollection : Collection<ISpecimenBuilderTransformation>, IList<ISpecimenBuilderTransformation>, ICollection<ISpecimenBuilderTransformation>, IReadOnlyList<ISpecimenBuilderTransformation>, IReadOnlyCollection<ISpecimenBuilderTransformation>, IEnumerable<ISpecimenBuilderTransformation>, IList, ICollection, IEnumerable
Remarks
Apart from containing a collection of ISpecimenBuilderTransformation instances, the SingletonSpecimenBuilderNodeStackCollectionAdapter also holds a reference to a ISpecimenBuilderNode graph. Every time an ISpecimenBuilderTransformation instance is added to the collection, it is also applied to the graph by invoking Transform(ISpecimenBuilder) against the existing graph. This doesn't change the existing graph, but produces a new graph, which then replaces the previous graph. The current graph is always available via the Graph property.
For all mutating operations on the collection, the SingletonSpecimenBuilderNodeStackCollectionAdapter replaces its internal graph with a new graph that encapsulates the new state. The original graph is not mutated, but when a seemingly mutating method is invoked, the GraphChanged event is raised.
Constructors
| Improve this Doc View SourceSingletonSpecimenBuilderNodeStackAdapterCollection(ISpecimenBuilderNode, Func<ISpecimenBuilderNode, Boolean>, ISpecimenBuilderTransformation[])
Initializes a new instance of the SingletonSpecimenBuilderNodeStackAdapterCollection class.
Declaration
public SingletonSpecimenBuilderNodeStackAdapterCollection(ISpecimenBuilderNode graph, Func<ISpecimenBuilderNode, bool> wrappedGraphPredicate, params ISpecimenBuilderTransformation[] transformations)
Parameters
Type | Name | Description |
---|---|---|
ISpecimenBuilderNode | graph | The base graph upon which the contained ISpecimenBuilderTransformation are applied. |
System.Func<ISpecimenBuilderNode, System.Boolean> | wrappedGraphPredicate | A predicate which identifies the wrapped graph. |
ISpecimenBuilderTransformation[] | transformations | The transformations to apply to |
Remarks
The transformations
and subsequent
transformations added to the instance are applied to a base graph.
The base graph is found by looking for a node within the graph
where wrappedGraphPredicate
returns true.
Properties
| Improve this Doc View SourceGraph
Gets the full graph.
Declaration
public ISpecimenBuilderNode Graph { get; }
Property Value
Type | Description |
---|---|
ISpecimenBuilderNode | The full graph produced by applying the collection of ISpecimenBuilderTransformation instances to the base graph. |
Methods
| Improve this Doc View SourceClearItems()
Removes all items from the collection.
Declaration
protected override void ClearItems()
Overrides
Remarks
Since this is a potentially mutating operation it may raise the GraphChanged event.
InsertItem(Int32, ISpecimenBuilderTransformation)
Inserts an element into the collection at the specified index.
Declaration
protected override void InsertItem(int index, ISpecimenBuilderTransformation item)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index at which |
ISpecimenBuilderTransformation | item | The item to insert. |
Overrides
Remarks
Since this is a mutating operation it raises the GraphChanged event.
OnGraphChanged(SpecimenBuilderNodeEventArgs)
Raises the GraphChanged event.
Declaration
protected virtual void OnGraphChanged(SpecimenBuilderNodeEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
SpecimenBuilderNodeEventArgs | e | The SpecimenBuilderNodeEventArgs instance containing the event data. |
RemoveItem(Int32)
Removes the element at the specified index of the collection.
Declaration
protected override void RemoveItem(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index of the element to remove. |
Overrides
Remarks
Since this is a mutating operation it raises the GraphChanged event.
SetItem(Int32, ISpecimenBuilderTransformation)
Replaces the element at the specified index.
Declaration
protected override void SetItem(int index, ISpecimenBuilderTransformation item)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index of the element to replace. |
ISpecimenBuilderTransformation | item | The new value for the element at the specified index. |
Overrides
Remarks
Since this is a mutating operation it raises the GraphChanged event.
Events
| Improve this Doc View SourceGraphChanged
Occurs when this instance changes its internal view of the encapsulated ISpecimenBuilderNode graph.
Declaration
public event EventHandler<SpecimenBuilderNodeEventArgs> GraphChanged
Event Type
Type | Description |
---|---|
System.EventHandler<SpecimenBuilderNodeEventArgs> |
Remarks
When this instance performs a mutating action, it replaces its previously encapsulated ISpecimenBuilderNode graph with a new graph where the change has been applied. The event arguments raised with the event contains a reference to the new graph.