public void IntGenerator_ShouldUseRandomNumber() { var factory = CreateFactoryWithRandomFunctions(); var fakeSetter = new FakePropertySetter { PropertyType = typeof(int) }; var func = factory.GetValueProvider(fakeSetter); Assert.Equal(firstRandomInt, func()); }
public void DateTimeGenerator_ShouldUseRandomNumbers() { var factory = CreateFactoryWithRandomFunctions(); var fakeSetter = new FakePropertySetter { PropertyType = typeof(DateTime) }; var func = factory.GetValueProvider(fakeSetter); var firstDate = func(); var secondDate = func(); Assert.NotEqual(new DateTime(), firstDate); Assert.NotEqual(firstDate, secondDate); }
public void DateTimeGenerator_ShouldOnlyGenerateDatesBetween1900and2100() { var factory = CreateFactoryWithRandomFunctions(); var fakeSetter = new FakePropertySetter { PropertyType = typeof(DateTime) }; var func = factory.GetValueProvider(fakeSetter); var min = new DateTime(1900, 01, 01); var max = new DateTime(2100, 01, 01); // TODO: Find a better way to test this for (int i = 0; i < 100000; i++) Assert.InRange(func(), min, max); }
public void StringGenerator_ShouldUsePropertyNamePlusRandomNumber() { var expected = "MyProperty 570869451"; // property name + first random number from provided seed var factory = CreateFactoryWithRandomFunctions(); var fakeSetter = new FakePropertySetter { Name = "MyProperty", PropertyType = typeof(string) }; var func = factory.GetValueProvider(fakeSetter); Assert.Equal(expected, func()); }