public void GetLastBTForEmployee_EmployeeNull_null() { //Arrange Employee employee = null; //Act DateTime?lastBTEndDate = DisplayPermitStatusHelper.GetLastBTForEmployee(employee); //Assert Assert.AreEqual(null, lastBTEndDate); }
public void GetLastBTForEmployee_EmployeeHasNoLastBT_null() { //Arrange Employee employee = mock.Object.Employees.Where(e => e.EmployeeID == 6).FirstOrDefault(); //Act DateTime?lastBTEndDate = DisplayPermitStatusHelper.GetLastBTForEmployee(employee); //Assert Assert.AreEqual(null, lastBTEndDate); }
public void GetLastBTForEmployee_EmployeeHasLastBT_ValidDate() { //Arrange Employee employee = mock.Object.Employees.Where(e => e.EmployeeID == 5).FirstOrDefault(); //Act DateTime?lastBTEndDate = DisplayPermitStatusHelper.GetLastBTForEmployee(employee); //Assert Assert.AreEqual(new DateTime(2013, 10, 05), lastBTEndDate.Value.Date); }
public void GetLastBTForEmployee_EmployeeHasNoLastBTWrongBTStatus_null() { //Arrange Employee employee = mock.Object.Employees.Where(e => e.EmployeeID == 5).FirstOrDefault(); employee.BusinessTrips.Where(b => b.BusinessTripID == 27).FirstOrDefault().Status = BTStatus.Cancelled; BusinessTrip lastBTwithWrongStatus = employee.BusinessTrips.Where(b => b.BusinessTripID == 27).FirstOrDefault(); employee.BusinessTrips.Clear(); employee.BusinessTrips.Add(lastBTwithWrongStatus); //Act DateTime?lastBTEndDate = DisplayPermitStatusHelper.GetLastBTForEmployee(employee); //Assert Assert.AreEqual(null, lastBTEndDate); }
public void GetLastBTForEmployee_EmployeeHasNoLastBTWrongDateLesserThanLastPermitStartDate_null() { //Arrange Employee employee = mock.Object.Employees.Where(e => e.EmployeeID == 5).FirstOrDefault(); employee.BusinessTrips.Where(b => b.BusinessTripID == 27).FirstOrDefault().StartDate = DateTime.Now.ToLocalTimeAzure().AddDays(-1200); employee.BusinessTrips.Where(b => b.BusinessTripID == 27).FirstOrDefault().EndDate = DateTime.Now.ToLocalTimeAzure().AddDays(-1000); BusinessTrip lastBTwithWrongStatus = employee.BusinessTrips.Where(b => b.BusinessTripID == 27).FirstOrDefault(); employee.BusinessTrips.Clear(); employee.BusinessTrips.Add(lastBTwithWrongStatus); //Act DateTime?lastBTEndDate = DisplayPermitStatusHelper.GetLastBTForEmployee(employee); //Assert Assert.AreEqual(null, lastBTEndDate); }