public void GenerateReturnsRandomValueWhenDobInFuture() { var dob = DateTime.Now.AddDays(1); var model = new AgeFromDob { DateOfBirth = dob }; var executeStrategy = Substitute.For <IExecuteStrategy>(); var buildChain = new BuildHistory(); buildChain.Push(model); executeStrategy.BuildChain.Returns(buildChain); var sut = new Wrapper { MinAge = 15, MaxAge = 30 }; var actual = (int)sut.RunGenerate(typeof(int), "age", executeStrategy) !; actual.Should().BeGreaterOrEqualTo(15); actual.Should().BeLessOrEqualTo(30); }
public void CanAssignAgeFromDob(int daysOld, int expectedYears) { var dob = DateTime.Now.AddDays(-daysOld); var model = new AgeFromDob { DateOfBirth = dob }; var executeStrategy = Substitute.For <IExecuteStrategy>(); var buildChain = new BuildHistory(); buildChain.Push(model); executeStrategy.BuildChain.Returns(buildChain); var sut = new Wrapper { MinAge = 15, MaxAge = 30 }; var actual = (int)sut.RunGenerate(typeof(int), "age", executeStrategy) !; actual.Should().Be(expectedYears); }