BrianSchroer / sparky-test-helpers

.NET unit test helper libraries - Source code for "SparkyTestHelper" nuget packages: SparkyTestHelpers, SparkyTestHelpers.AppSettings, SparkyTestHelpers.AutoMapper, SparkyTestHelpers.Mapping, SparkyTestHelpers.Moq, SparkyTestHelpers.Xml
https://www.nuget.org/packages?q=SparkyTestHelpers
MIT License
4 stars 5 forks source link

Populater.CreateRandom<T>() creates duplicate instances #5

Closed Samurai303 closed 5 years ago

Samurai303 commented 5 years ago

When calling Populater.CreateRandom() for two of the same object, the properties values are the same. Take a simple class

public class DataTest
{
    public string DataLine1 { get; set; }
    public string DataLine2 { get; set; }
    public bool UseData { get; set; }
}

Then the following code returns the same values for both instances

var data1 = populater.CreateRandom<DataTest>();
var data2 = populater.CreateRandom<DataTest>();

It seems to be down to the RandomValueProvider creating it's own instance of Random() with the same seed.

BrianSchroer commented 5 years ago

Thanks for reporting it. It's fixed with version 1.3.2.