public void throw_NotImplementedException_on_calling_ConvertBack() { // Arrange var _objectUnderTest = new BirthdayToAgeConverter(); // Assert Assert.Throws <NotImplementedException>(() => { _objectUnderTest.ConvertBack(null, null, null, null); }); }
public void succesfully_convert_birthday_date_to_age(DateTime birthdayDate) { // Arrange var _objectUnderTest = new BirthdayToAgeConverter(); var expectedResult = DateTime.Today.Year - birthdayDate.Year; if (birthdayDate.Date > DateTime.Today.AddYears(-expectedResult)) { expectedResult--; } expectedResult = expectedResult >= 0 ? expectedResult : 0; // Act var result = _objectUnderTest.Convert(birthdayDate, null, null, null); // Assert Assert.AreEqual(expectedResult, result); }