Class CollectionFiller
Contains extension methods for populating collections with specimens.
Inheritance
Inherited Members
Namespace: AutoFixture
Assembly: AutoFixture.dll
Syntax
public static class CollectionFiller
Methods
| Improve this Doc View SourceAddMany<T>(ICollection<T>, Func<T>, Int32)
Adds many objects to a list.
Declaration
public static void AddMany<T>(this ICollection<T> collection, Func<T> creator, int repeatCount)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.ICollection<T> | collection | The collection to which objects should be added. |
System.Func<T> | creator | A function that will be called many times to create objects that will be added to
|
System.Int32 | repeatCount | The number of times |
Type Parameters
Name | Description |
---|---|
T | The type of object contained within the list. |
AddManyTo<T>(IFixture, ICollection<T>)
Adds many anonymously created objects to a list.
Declaration
public static void AddManyTo<T>(this IFixture fixture, ICollection<T> collection)
Parameters
Type | Name | Description |
---|---|---|
IFixture | fixture | The fixture. |
System.Collections.Generic.ICollection<T> | collection | The list to which the anonymously created objects will be added. |
Type Parameters
Name | Description |
---|---|
T | The type of object that is contained in the list. |
Remarks
The number of objects created and added is determined by RepeatCount.
See Also
| Improve this Doc View SourceAddManyTo<T>(IFixture, ICollection<T>, Func<T>)
Adds many objects to a list using the provided function to create each object.
Declaration
public static void AddManyTo<T>(this IFixture fixture, ICollection<T> collection, Func<T> creator)
Parameters
Type | Name | Description |
---|---|---|
IFixture | fixture | The fixture. |
System.Collections.Generic.ICollection<T> | collection | The list to which the created objects will be added. |
System.Func<T> | creator | The function that creates each object which is subsequently added to
|
Type Parameters
Name | Description |
---|---|
T | The type of object that is contained in the list. |
Remarks
The number of objects created and added is determined by RepeatCount.
See Also
| Improve this Doc View SourceAddManyTo<T>(IFixture, ICollection<T>, Int32)
Adds many anonymously created objects to a list.
Declaration
public static void AddManyTo<T>(this IFixture fixture, ICollection<T> collection, int repeatCount)
Parameters
Type | Name | Description |
---|---|---|
IFixture | fixture | The fixture. |
System.Collections.Generic.ICollection<T> | collection | The list to which the anonymously created objects will be added. |
System.Int32 | repeatCount | The number of objects created and added. |
Type Parameters
Name | Description |
---|---|
T | The type of object that is contained in the list. |