public void Parse_EqualsExpectedResult(MonthTestItem <string> monthTestItem) { var monthFromText = Month.Parse(monthTestItem.ExpectedResult); // TODO bad use of Expected result? var expectedMonth = monthTestItem.Create(); Assert.AreEqual(expectedMonth, monthFromText); }
public void MinusOperatorIntParameter_ReturnsExpectedResult(MonthTestItem <int, Month> monthTestItem) { var month = monthTestItem.Create(); var monthAfterSubtraction = month - monthTestItem.ParameterValue; Assert.AreEqual(monthTestItem.ExpectedResult, monthAfterSubtraction); }
public void AdditionOperator_ReturnsExpectedResult(MonthTestItem <int, Month> monthTestItem) { var month = monthTestItem.Create(); var monthAfterAddition = month + monthTestItem.ParameterValue; Assert.AreEqual(monthTestItem.ExpectedResult, monthAfterAddition); }
public void MinusOperatorMonthParameter_ReturnsExpectedResult(MonthTestItem <Month, int> monthTestItem) { var month1 = monthTestItem.Create(); var diff = month1 - monthTestItem.ParameterValue; Assert.AreEqual(monthTestItem.ExpectedResult, diff); }
public void Offset_ReturnsExpectedResult(MonthTestItem <int, Month> monthTestItem) { var startMonth = monthTestItem.Create(); var offsetMonth = startMonth.Offset(monthTestItem.ParameterValue); Assert.AreEqual(monthTestItem.ExpectedResult, offsetMonth); }
public void End_ShouldEqualDateTimeForStartOfNextMonth(MonthTestItem monthTestItem) { var month = monthTestItem.Create(); var expectedEnd = new DateTime(monthTestItem.YearNum, monthTestItem.MonthOfYear, 1).AddMonths(1); Assert.AreEqual(expectedEnd, month.End); }
public void Start_ShouldEqualDateTimeForStartOfMonth(MonthTestItem monthTestItem) { var month = monthTestItem.Create(); var expectedStart = new DateTime(monthTestItem.YearNum, monthTestItem.MonthOfYear, 1); Assert.AreEqual(expectedStart, month.Start); }
public void ToString_EqualsExpectedResult( MonthTestItem <string> monthTestItem) { var month = monthTestItem.Create(); var formatted = month.ToString(); Assert.AreEqual(monthTestItem.ExpectedResult, formatted); }
public void OffsetFrom_ReturnsExpectedResult(MonthTestItem <Month, int> monthTestItem) { var month1 = monthTestItem.Create(); var month2 = monthTestItem.ParameterValue; var offsetFrom = month1.OffsetFrom(month2); Assert.AreEqual(monthTestItem.ExpectedResult, offsetFrom); }
public void Deconstruct_ReturnsComponentsUsedToConstruct(MonthTestItem testItem) { var month = testItem.Create(); (int year, int monthOfYear) = month; Assert.AreEqual(testItem.YearNum, year); Assert.AreEqual(testItem.MonthOfYear, monthOfYear); }
public void Constructor_WithMonthParameterOutOfRange_ThrowsArgumentOutOfRangeException(MonthTestItem month) { // ReSharper disable once ObjectCreationAsStatement Assert.Throws <ArgumentOutOfRangeException>(() => month.Create()); }
public void MonthOfYearProperty_EqualsMonthUsedToConstruct(MonthTestItem monthTestItem) { var month = monthTestItem.Create(); Assert.AreEqual(monthTestItem.MonthOfYear, month.MonthOfYear); }
public void YearProperty_EqualsYearUsedToConstruct(MonthTestItem monthTestItem) { var month = monthTestItem.Create(); Assert.AreEqual(monthTestItem.YearNum, month.Year); }