Class SpecimenBuilderNodeAdapterCollection
Presents a horizontal slice of an ISpecimenBuilderNode graph as if it was a collection.
Inheritance
Implements
Inherited Members
Namespace: AutoFixture
Assembly: AutoFixture.dll
Syntax
public class SpecimenBuilderNodeAdapterCollection : IList<ISpecimenBuilder>, ICollection<ISpecimenBuilder>, IEnumerable<ISpecimenBuilder>, IEnumerable
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
| Improve this Doc View SourceSpecimenBuilderNodeAdapterCollection(ISpecimenBuilderNode, Func<ISpecimenBuilderNode, Boolean>)
Initializes a new instance of the SpecimenBuilderNodeAdapterCollection class.
Declaration
public SpecimenBuilderNodeAdapterCollection(ISpecimenBuilderNode graph, Func<ISpecimenBuilderNode, bool> adaptedBuilderPredicate)
Parameters
Type | Name | Description |
---|---|---|
ISpecimenBuilderNode | graph | The underlying graph. |
System.Func<ISpecimenBuilderNode, System.Boolean> | adaptedBuilderPredicate | A predicate which is used to identify a node in
|
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
| Improve this Doc View SourceCount
Gets the number of elements contained in the collection.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The number of elements contained in 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
Graph
Gets the graph which is the backing store of the collection.
Declaration
public ISpecimenBuilderNode Graph { get; }
Property Value
Type | Description |
---|---|
ISpecimenBuilderNode | The graph which is the backing store of 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
IsReadOnly
Gets a value indicating whether this instance is read only.
Declaration
public bool IsReadOnly { get; }
Property Value
Type | Description |
---|---|
System.Boolean | true if this instance is read only; otherwise, false. |
Item[Int32]
Gets or sets the ISpecimenBuilder at the specified index.
Declaration
public ISpecimenBuilder this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index of the element to get or set. |
Property Value
Type | Description |
---|---|
ISpecimenBuilder | The ISpecimenBuilder at the specified index. |
Methods
| Improve this Doc View SourceAdd(ISpecimenBuilder)
Adds an item to the collection.
Declaration
public void Add(ISpecimenBuilder item)
Parameters
Type | Name | Description |
---|---|---|
ISpecimenBuilder | item | 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
Clear()
Removes all items from the collection.
Declaration
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
Contains(ISpecimenBuilder)
Determines whether the collection contains a specific value.
Declaration
public bool Contains(ISpecimenBuilder item)
Parameters
Type | Name | Description |
---|---|---|
ISpecimenBuilder | item | The item to locate in the collection. |
Returns
Type | Description |
---|---|
System.Boolean | true if |
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
CopyTo(ISpecimenBuilder[], Int32)
Copies the elements of the collection to an System.Array, starting at a particular Array index.
Declaration
public void CopyTo(ISpecimenBuilder[] array, int arrayIndex)
Parameters
Type | Name | Description |
---|---|---|
ISpecimenBuilder[] | array | The one-dimensional System.Array that is the destination of the elements copied from the collection. The Array must have zero-based indexing. |
System.Int32 | arrayIndex | 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
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
public IEnumerator<ISpecimenBuilder> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<ISpecimenBuilder> | A System.Collections.Generic.IEnumerator<T> 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
IndexOf(ISpecimenBuilder)
Determines the index of a specific item in the collection.
Declaration
public int IndexOf(ISpecimenBuilder item)
Parameters
Type | Name | Description |
---|---|---|
ISpecimenBuilder | item | The object to locate in the collection. |
Returns
Type | Description |
---|---|
System.Int32 | The index of |
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
Insert(Int32, ISpecimenBuilder)
Inserts an item to the collection at the specified index.
Declaration
public void Insert(int index, ISpecimenBuilder item)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index at which |
ISpecimenBuilder | item | 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
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. |
Remove(ISpecimenBuilder)
Removes the first occurrence of a specific object from the collection.
Declaration
public bool Remove(ISpecimenBuilder item)
Parameters
Type | Name | Description |
---|---|---|
ISpecimenBuilder | item | The object to remove from the collection. |
Returns
Type | Description |
---|---|
System.Boolean | true if |
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
RemoveAt(Int32)
Removes the item at the specified index from the collection.
Declaration
public void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | 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
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.
Explicit Interface Implementations
| Improve this Doc View SourceIEnumerable.GetEnumerator()
Returns an enumerator that iterates through a collection.
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator | An System.Collections.IEnumerator object 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.