public BirthingUnitTests() { _randomNumberGeneratorMock = new Mock <IRandomNumberGenerator>(); var fakeClock = new Mock <IClock>(); fakeClock.Setup(x => x.Now()).Returns(new DateTime(2000, 1, 1)); fakeClock.Setup(x => x.NowOld()).Returns(new DateTime(2000, 1, 1)); _birthingUnit = new BirthingUnit(_randomNumberGeneratorMock.Object, fakeClock.Object); }
public void TestGetMarried() { BirthingUnit birthingUnit = new BirthingUnit(); string fullName = birthingUnit.GetMarried(new People("Bob"), "test"); Assert.Equal("Bob", fullName); string fullName = birthingUnit.GetMarried(new People("Bob"), "Trump"); Assert.Equal("Bob Trump", fullName); }
public void TestIsGetBobOlderThen30() { BirthingUnit birthingUnit = new BirthingUnit(); var people = birthingUnit.GetPeople(5); var bobMan = birthingUnit.GetBobs(true); bool isBobOlderThen30 = true; foreach (People bob in bobMan) { int age = DateTime.Now.Year - bob.DOB.Year; if (age < 30) { isBobOlderThen30 = false; } } Assert.True(isBobOlderThen30); }
public void TestPeopleCount() { BirthingUnit birthingUnit = new BirthingUnit(); var people = birthingUnit.GetPeople(5); Assert.Equal(5, people.Count); }