public void StudentRepository_CurrentStudents_Test(DateTime now, int expectedLength) { var allStudents = new Student[] { new Student { FirstMidName = "a", LastName = "b", EnrollmentDate = new DateTime(2018, 8, 1), }, new Student { FirstMidName = "c", LastName = "d", EnrollmentDate = new DateTime(2018, 7, 31), }, }; using var schoolContext = new MockSchoolDatabase(allStudents); var dateTime = new MockDateTime(now); var studentRepository = new StudentRepository(schoolContext, dateTime); CollectionAssert.AreEqual(allStudents.Take(expectedLength).ToArray(), studentRepository.CurrentStudents.ToArray()); }
public void StudentRepository_CurrentStudentsStartDate_Test( int inputYear, int inputMonth, int inputDay, int expectedYear, int expectedMonth, int expectedDay) { using var schoolContext = new MockSchoolDatabase(); var dateTime = new MockDateTime(new DateTime(inputYear, inputMonth, inputDay)); var studentRepository = new StudentRepository(schoolContext, dateTime); Assert.AreEqual(new DateTime(expectedYear, expectedMonth, expectedDay), studentRepository.CurrentStudentsStartDate); }