SparkyTestHelpers.Populater 1.3.4

Tools for populating class instance properties for testing.

Install-Package SparkyTestHelpers.Populater -Version 1.3.4
dotnet add package SparkyTestHelpers.Populater --version 1.3.4
<PackageReference Include="SparkyTestHelpers.Populater" Version="1.3.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SparkyTestHelpers.Populater --version 1.3.4
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.4 - Added support for GetRandom<T> where T is string or a primitive type.

GitHub repositories (0)

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.3.4 381 8/14/2019
1.3.3 443 7/27/2019
1.3.2 243 4/20/2019
1.3.1 266 2/5/2019
1.3.0 159 2/2/2019
1.2.1 200 1/16/2019
1.2.0 10,397 1/15/2019
1.1.0 208 1/3/2019
1.0.2 264 1/1/2019
1.0.1 205 1/1/2019
1.0.0 165 12/25/2018