ipjohnson / SimpleFixture

Testing fixture for .Net
MIT License
11 stars 2 forks source link

Typed Constraint values #6

Closed ipjohnson closed 8 years ago

ipjohnson commented 8 years ago

Sometimes it's useful to be able to provide a value to be used during generation but you don't know what the name of the parameter or property is that you want to provide.

If a constraint has an IEnumerable property called _Values then these values will be used during location, population, and generation.

var someClass = new SomeClass { IntValue = 50, StringValue = "Test" }; var instance = fixture.Generate(constraints: new { _Values = new[] { someClass } }); Assert.Same(someClass, instance.SomeClass);