public void IComparableCompareTo_WithParameterEqualToNull_Returns1(int yearNum) { IComparable calYear = new CalendarYear(yearNum); var comp = calYear.CompareTo(null); Assert.AreEqual(1, comp); }
public void IComparableCompareTo_WithParameterNotOfCalendarYearType_ThrowsArgumentException(int yearNum) { IComparable calYear = new CalendarYear(yearNum); object obj = new object(); // ReSharper disable once ReturnValueOfPureMethodIsNotUsed Assert.Throws <ArgumentException>(() => calYear.CompareTo(obj)); }
public void IComparableCompareTo_WithParameterIdenticalToInstance_ReturnsZero(int yearNum) { IComparable calYear1 = new CalendarYear(yearNum); object calYear2 = new CalendarYear(yearNum); var comp = calYear1.CompareTo(calYear2); Assert.AreEqual(0, comp); }
public void IComparableCompareTo_WithParameterLaterThanInstance_ReturnsNegativeNumber(int yearNumInstance, int yearNumParameter) { IComparable calYear1 = new CalendarYear(yearNumInstance); object calYear2 = new CalendarYear(yearNumParameter); var comp = calYear1.CompareTo(calYear2); Assert.That(comp, Is.LessThan(0)); }
public void CompareTo_WithParameterEarlierThanInstance_ReturnsPositiveNumber(int yearNumInstance, int yearNumParameter) { var calYear1 = new CalendarYear(yearNumInstance); var calYear2 = new CalendarYear(yearNumParameter); var comp = calYear1.CompareTo(calYear2); Assert.That(comp, Is.GreaterThan(0)); }