Class SpecimenBuilderNodeAdapterCollection
Namespace: AutoFixture
Assembly: AutoFixture.dll
Presents a horizontal slice of an ISpecimenBuilderNode
graph as if it was a collection.
public class SpecimenBuilderNodeAdapterCollection : IList<ISpecimenBuilder>, ICollection<ISpecimenBuilder>, IEnumerable<ISpecimenBuilder>, IEnumerableInheritance
object ← SpecimenBuilderNodeAdapterCollection
Implements
IList<ISpecimenBuilder>, ICollection<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
Remarks
This class encapsulates an ISpecimenBuilderNode graph
and presents a horizontal slice of the graph as if it was a collection.
For all mutating operations on the collection, the
SpecimenBuilderNodeCollectionAdapter 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
SpecimenBuilderNodeAdapterCollection(ISpecimenBuilderNode, Func<ISpecimenBuilderNode, bool>)
Initializes a new instance of the
SpecimenBuilderNodeAdapterCollection class.
public SpecimenBuilderNodeAdapterCollection(ISpecimenBuilderNode graph, Func<ISpecimenBuilderNode, bool> adaptedBuilderPredicate)Parameters
graph ISpecimenBuilderNode
The underlying graph.
adaptedBuilderPredicate Func<ISpecimenBuilderNode, bool>
A predicate which is used to identify a node in
graph.
Remarks
adaptedBuilderPredicate must identify a single
node in graph. If zero or several nodes are
identified by this predicate, an exception will be thrown.
The node identified by the predicate is used as a source of the collection exposed by the SpecimenBuilderNodeCollectionAdapter class. When you enumerate all items in the collection, you really enumerate the children of the identified node.
Properties
Count
Gets the number of elements contained in the collection.
public int Count { get; }Property Value
Remarks
In this context, the term collection refers to the horizontal slice through the encapsulated `ISpecimenBuilderNode` graph that this instance exposes as a collection.
See Also
SpecimenBuilderNodeAdapterCollection, SpecimenBuilderNodeAdapterCollection.SpecimenBuilderNodeAdapterCollection(ISpecimenBuilderNode, Func<ISpecimenBuilderNode, bool>)
Graph
Gets the graph which is the backing store of the collection.
public ISpecimenBuilderNode Graph { get; }Property Value
Remarks
In this context, the term collection refers to the horizontal slice through the encapsulated `ISpecimenBuilderNode` graph that this instance exposes as a collection.
See Also
SpecimenBuilderNodeAdapterCollection, SpecimenBuilderNodeAdapterCollection.SpecimenBuilderNodeAdapterCollection(ISpecimenBuilderNode, Func<ISpecimenBuilderNode, bool>)
IsReadOnly
Gets a value indicating whether this instance is read only.
public bool IsReadOnly { get; }Property Value
this[int]
Gets or sets the ISpecimenBuilder at the specified
index.
public ISpecimenBuilder this[int index] { get; set; }Property Value
Methods
Add(ISpecimenBuilder)
Adds an item to the collection.
public void Add(ISpecimenBuilder item)Parameters
item ISpecimenBuilder
he object to add to the collection.
Remarks
In this context, the term collection refers to the horizontal slice through the encapsulated `ISpecimenBuilderNode` graph that this instance exposes as a collection.
Since this is a mutating operation it raises the `GraphChanged` event.
See Also
SpecimenBuilderNodeAdapterCollection, SpecimenBuilderNodeAdapterCollection.SpecimenBuilderNodeAdapterCollection(ISpecimenBuilderNode, Func<ISpecimenBuilderNode, bool>)
Clear()
Removes all items from the collection.
public void Clear()Remarks
In this context, the term collection refers to the horizontal slice through the encapsulated `ISpecimenBuilderNode` graph that this instance exposes as a collection.
Since this is a mutating operation it raises the `GraphChanged` event.
See Also
SpecimenBuilderNodeAdapterCollection, SpecimenBuilderNodeAdapterCollection.SpecimenBuilderNodeAdapterCollection(ISpecimenBuilderNode, Func<ISpecimenBuilderNode, bool>)
Contains(ISpecimenBuilder)
Determines whether the collection contains a specific value.
public bool Contains(ISpecimenBuilder item)Parameters
item ISpecimenBuilder
The item to locate in the collection.
Returns
true if item is found in the
collection; otherwise, false.
Remarks
In this context, the term collection refers to the horizontal slice through the encapsulated `ISpecimenBuilderNode` graph that this instance exposes as a collection.
See Also
SpecimenBuilderNodeAdapterCollection, SpecimenBuilderNodeAdapterCollection.SpecimenBuilderNodeAdapterCollection(ISpecimenBuilderNode, Func<ISpecimenBuilderNode, bool>)
CopyTo(ISpecimenBuilder[], int)
Copies the elements of the collection to an
Array, starting at a particular Array index.
public void CopyTo(ISpecimenBuilder[] array, int arrayIndex)Parameters
array ISpecimenBuilder[]
The one-dimensional Array that is the destination of
the elements copied from the collection. The Array must have
zero-based indexing.
arrayIndex int
The zero-based index in array at which copying begins.
Remarks
In this context, the term collection refers to the horizontal slice through the encapsulated `ISpecimenBuilderNode` graph that this instance exposes as a collection.
See Also
SpecimenBuilderNodeAdapterCollection, SpecimenBuilderNodeAdapterCollection.SpecimenBuilderNodeAdapterCollection(ISpecimenBuilderNode, Func<ISpecimenBuilderNode, bool>)
GetEnumerator()
Returns an enumerator that iterates through the collection.
public IEnumerator<ISpecimenBuilder> GetEnumerator()Returns
A IEnumerator%601 that can be used to
iterate through the collection.
Remarks
In this context, the term collection refers to the horizontal slice through the encapsulated `ISpecimenBuilderNode` graph that this instance exposes as a collection.
See Also
SpecimenBuilderNodeAdapterCollection, SpecimenBuilderNodeAdapterCollection.SpecimenBuilderNodeAdapterCollection(ISpecimenBuilderNode, Func<ISpecimenBuilderNode, bool>)
IndexOf(ISpecimenBuilder)
Determines the index of a specific item in the collection.
public int IndexOf(ISpecimenBuilder item)Parameters
item ISpecimenBuilder
The object to locate in the collection.
Returns
The index of item if found in the list;
otherwise, -1.
Remarks
In this context, the term collection refers to the horizontal slice through the encapsulated `ISpecimenBuilderNode` graph that this instance exposes as a collection.
See Also
SpecimenBuilderNodeAdapterCollection, SpecimenBuilderNodeAdapterCollection.SpecimenBuilderNodeAdapterCollection(ISpecimenBuilderNode, Func<ISpecimenBuilderNode, bool>)
Insert(int, ISpecimenBuilder)
Inserts an item to the collection at the specified index.
public void Insert(int index, ISpecimenBuilder item)Parameters
index int
The zero-based index at which item should be
inserted.
item ISpecimenBuilder
The object to insert into the collection.
Remarks
In this context, the term collection refers to the horizontal slice through the encapsulated `ISpecimenBuilderNode` graph that this instance exposes as a collection.
Since this is a mutating operation it raises the `GraphChanged` event.
See Also
SpecimenBuilderNodeAdapterCollection, SpecimenBuilderNodeAdapterCollection.SpecimenBuilderNodeAdapterCollection(ISpecimenBuilderNode, Func<ISpecimenBuilderNode, bool>)
OnGraphChanged(SpecimenBuilderNodeEventArgs)
Raises the GraphChanged event.
protected virtual void OnGraphChanged(SpecimenBuilderNodeEventArgs e)Parameters
e SpecimenBuilderNodeEventArgs
The SpecimenBuilderNodeEventArgs instance containing
the event data.
Remove(ISpecimenBuilder)
Removes the first occurrence of a specific object from the collection.
public bool Remove(ISpecimenBuilder item)Parameters
item ISpecimenBuilder
The object to remove from the collection.
Returns
true if item was
successfully removed from the collection; otherwise,
false. This method also returns
false if the item is not found in the original
collection.
Remarks
In this context, the term collection refers to the horizontal slice through the encapsulated `ISpecimenBuilderNode` graph that this instance exposes as a collection.
Since this is a mutating operation it raises the `GraphChanged` event.
See Also
SpecimenBuilderNodeAdapterCollection, SpecimenBuilderNodeAdapterCollection.SpecimenBuilderNodeAdapterCollection(ISpecimenBuilderNode, Func<ISpecimenBuilderNode, bool>)
RemoveAt(int)
Removes the item at the specified index from the collection.
public void RemoveAt(int index)Parameters
index int
The zero-based index of the item to remove.
Remarks
In this context, the term collection refers to the horizontal slice through the encapsulated `ISpecimenBuilderNode` graph that this instance exposes as a collection.
Since this is a mutating operation it raises the `GraphChanged` event.
See Also
SpecimenBuilderNodeAdapterCollection, SpecimenBuilderNodeAdapterCollection.SpecimenBuilderNodeAdapterCollection(ISpecimenBuilderNode, Func<ISpecimenBuilderNode, bool>)
GraphChanged
Occurs when this instance changes its internal view of the
encapsulated ISpecimenBuilderNode graph.
public event EventHandler<SpecimenBuilderNodeEventArgs> GraphChangedEvent Type
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.