public void Should_Use_Custom_Boundaries_for_Integer_Value_Injection() { //Create an instance of our test class var testInstance = new IntegerTestClass(); var intMax = 10; var intMin = 1; //Create an instance of our IntSelector and set some custom bounds var selector = new IntSelector().SetMax(() => Faker.Generators.Numbers.Int(intMax, intMax)) .SetMin(() => Faker.Generators.Numbers.Int(intMin, intMin)); //Iterate over the test object's properties foreach (var property in testInstance.GetType().GetProperties()) { Assert.IsTrue(selector.CanBind(property), string.Format("should have been able to bind to property {0}", property.Name)); //Inject the value into this property on our test instance class selector.Generate(testInstance, property); //Get the value out of the property var fieldValue = (int)property.GetValue(testInstance, null); Assert.IsNotNull(fieldValue); Assert.AreNotEqual(fieldValue, default(int)); Assert.IsTrue(fieldValue <= intMax && fieldValue >= intMin, "Custom range should have worked"); } }