public void SubtractYears_WhenSubtractingYears_ReturnNewInstance() { // Arrange var date = new DuodecimDate(2018, 6); // Act var newDate = date.SubtractYears(1); // Assert Assert.False(Equals(date, newDate)); }
public void SubtractYears_WhenSubtractingNegativeYears_ThrowArgumentOutOfRangeException() { // Arrange const int yearsToSubtract = -1; var date = new DuodecimDate(2018, 6); // Act var exception = Record.Exception(() => date.SubtractYears(yearsToSubtract)); // Assert exception.Verify <ArgumentOutOfRangeException>(string.Format(ExpectedYearOrMonthIsNegativeExceptionMessage, "years")); }
public void SubtractYears_WhenSubtractingYears_YearsSubtracted() { // Arrange const int startYear = 2018; const int yearsToSubtract = 13; const int expectedYear = startYear - yearsToSubtract; var date = new DuodecimDate(startYear, 6); // Act var newDate = date.SubtractYears(yearsToSubtract); // Assert Assert.Equal(expectedYear, newDate.Year); }
public void SubtractYears_WhenSubtractingYearsSoTheResultYieldsAnInvalidYear_ThrowInvalidDuodecimDateException() { // Arrange const int startYear = 2018; const int yearsToSubtract = startYear; const int expectedErrorMessageYear = startYear - yearsToSubtract; const int month = 6; var date = new DuodecimDate(startYear, 6); // Act var exception = Record.Exception(() => date.SubtractYears(yearsToSubtract)); // Assert exception.Verify <InvalidDuodecimDateException>(string.Format(ExpectedInvalidDuodecimDateExceptionMessage, expectedErrorMessageYear, month)); }