public void Build_WhenCalledWithSingleYear_ReturnsNullAndSpecifiedYear() { GetYearsForDoBProcess process = new GetYearsForDoBProcess(_mockLogger.Object); List <KeyValuePair <int?, string> > list = process.Build(2001, 2001); Assert.AreEqual(2, list.Count); AssertKeyValuePair(null, "Year", list[0]); AssertKeyValuePair(2001, "2001", list[1]); }
public void Build_WhenCalledWithFiveYearss_ReturnsNullAndSpecifiedYearsInReverseOrder() { GetYearsForDoBProcess process = new GetYearsForDoBProcess(_mockLogger.Object); List <KeyValuePair <int?, string> > list = process.Build(1999, 2003); Assert.AreEqual(6, list.Count); AssertKeyValuePair(null, "Year", list[0]); AssertKeyValuePair(2003, "2003", list[1]); AssertKeyValuePair(2002, "2002", list[2]); AssertKeyValuePair(2001, "2001", list[3]); AssertKeyValuePair(2000, "2000", list[4]); AssertKeyValuePair(1999, "1999", list[5]); }
public void Build_WhenCalledWithYearsInWrongOrder_ThrowsArgumentException() { GetYearsForDoBProcess process = new GetYearsForDoBProcess(_mockLogger.Object); try { List <KeyValuePair <int?, string> > list = process.Build(2000, 1999); Assert.Fail("Expected exception did not occur"); } catch (ArgumentException ex) { Assert.AreEqual("minYear must be <= maxYear", ex.Message); } }