SparkyTestHelpers.Populater 1.3.2

Tools for populating class instance properties for testing.

Install-Package SparkyTestHelpers.Populater -Version 1.3.2
dotnet add package SparkyTestHelpers.Populater --version 1.3.2
<PackageReference Include="SparkyTestHelpers.Populater" Version="1.3.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SparkyTestHelpers.Populater --version 1.3.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

see also:


This project provides tools for populating class instance properties for testing purposes, usually with random values:

using SparkyTestHelpers.Population;
    var populater = new Populater();

    var foo = new Foo();
    populater.PopulateWithRandomValues(foo);

    var foo2 = populater.CreateRandom<Foo>();

There's also a GetRandom static method that uses Populater "behind the scenes":

using SparkyTestHelpers.Population;
    var foo = GetRandom.InstanceOf<Foo>();

The project also has a SequentialValueProvider and associated methods that populates class properties with predictable/repeatable values. I hope to use it in the future for "snapshot testing":

using SparkyTestHelpers.Population;
    var populater = new Populater();

    var foo = new Foo();
    populater.Populate(foo, new SequentialValueProvider()); 

    // (SequentialValueProvider is the default provider for the "Populate" method:
    var foo2 = new Foo();
    populater.Populate(foo);

    var foo3 = populater.CreateAndPopulate<Foo>();

see also:


This project provides tools for populating class instance properties for testing purposes, usually with random values:

using SparkyTestHelpers.Population;
    var populater = new Populater();

    var foo = new Foo();
    populater.PopulateWithRandomValues(foo);

    var foo2 = populater.CreateRandom<Foo>();

There's also a GetRandom static method that uses Populater "behind the scenes":

using SparkyTestHelpers.Population;
    var foo = GetRandom.InstanceOf<Foo>();

The project also has a SequentialValueProvider and associated methods that populates class properties with predictable/repeatable values. I hope to use it in the future for "snapshot testing":

using SparkyTestHelpers.Population;
    var populater = new Populater();

    var foo = new Foo();
    populater.Populate(foo, new SequentialValueProvider()); 

    // (SequentialValueProvider is the default provider for the "Populate" method:
    var foo2 = new Foo();
    populater.Populate(foo);

    var foo3 = populater.CreateAndPopulate<Foo>();

Release Notes

v1.3.2 - Fixed random seed bug that resulted in separate randomly populated class instances having the same values.

Version History

Version Downloads Last updated
1.3.2 127 4/20/2019
1.3.1 120 2/5/2019
1.3.0 62 2/2/2019
1.2.1 85 1/16/2019
1.2.0 403 1/15/2019
1.1.0 80 1/3/2019
1.0.2 145 1/1/2019
1.0.1 76 1/1/2019
1.0.0 76 12/25/2018