Example #1
0
        public void GivenDateOfBirth_ShouldCorrectlyCalculateAge()
        {
            var test = new DateOfBirth("870412");

            var beforeBirthday = new DateTime(2017, 4, 2);

            Assert.AreEqual(29, test.AgeOn(beforeBirthday));

            var onBirthday = new DateTime(2017, 4, 12);

            Assert.AreEqual(30, test.AgeOn(onBirthday));

            var afterBirthday = new DateTime(2017, 4, 15);

            Assert.AreEqual(30, test.AgeOn(afterBirthday));

            afterBirthday = new DateTime(2017, 8, 1);
            Assert.AreEqual(30, test.AgeOn(afterBirthday));
        }