Class CollectionFiller
Namespace: AutoFixture
Assembly: AutoFixture.dll
Contains extension methods for populating collections with specimens.
public static class CollectionFillerInheritance
Inherited Members
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Methods
AddMany<T>(ICollection<T>, Func<T>, int)
Adds many objects to a list.
public static void AddMany<T>(this ICollection<T> collection, Func<T> creator, int repeatCount)Parameters
collection ICollection<T>
The collection to which objects should be added.
creator Func<T>
A function that will be called many times to create objects that will be added to
collection.
repeatCount int
The number of times creator is invoked, and hence the number of
items added to collection.
Type Parameters
T
The type of object contained within the list.
AddManyTo<T>(IFixture, ICollection<T>)
Adds many anonymously created objects to a list.
public static void AddManyTo<T>(this IFixture fixture, ICollection<T> collection)Parameters
fixture IFixture
The fixture.
collection ICollection<T>
The list to which the anonymously created objects will be added.
Type Parameters
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
CollectionFiller.AddManyTo<T>(IFixture, ICollection<T>, int), CollectionFiller.AddManyTo<T>(IFixture, ICollection<T>, Func<T>)
AddManyTo<T>(IFixture, ICollection<T>, int)
Adds many anonymously created objects to a list.
public static void AddManyTo<T>(this IFixture fixture, ICollection<T> collection, int repeatCount)Parameters
fixture IFixture
The fixture.
collection ICollection<T>
The list to which the anonymously created objects will be added.
repeatCount int
The number of objects created and added.
Type Parameters
T
The type of object that is contained in the list.
See Also
CollectionFiller.AddManyTo<T>(IFixture, ICollection<T>), CollectionFiller.AddManyTo<T>(IFixture, ICollection<T>, Func<T>)
AddManyTo<T>(IFixture, ICollection<T>, Func<T>)
Adds many objects to a list using the provided function to create each object.
public static void AddManyTo<T>(this IFixture fixture, ICollection<T> collection, Func<T> creator)Parameters
fixture IFixture
The fixture.
collection ICollection<T>
The list to which the created objects will be added.
creator Func<T>
The function that creates each object which is subsequently added to
collection.
Type Parameters
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
CollectionFiller.AddManyTo<T>(IFixture, ICollection<T>), CollectionFiller.AddManyTo<T>(IFixture, ICollection<T>, int)