public async Task TestUpdateAttendanceStatusSuccessfully() { //Arrange var listToUpdate = new List <AttendanceReports>(); listToUpdate.Add(new AttendanceReports() { AttendanceId = 1, Status = "future", TimeTableId = 1, UserId = "2" }); listToUpdate.Add(new AttendanceReports() { AttendanceId = 2, Status = "future", TimeTableId = 1, UserId = "2" }); listToUpdate.Add(new AttendanceReports() { AttendanceId = 3, Status = "future", TimeTableId = 1, UserId = "2" }); await context.AttendanceReports.AddRangeAsync(listToUpdate); await context.SaveChangesAsync(); var listUpdate = await context.AttendanceReports.ToListAsync(); foreach (var rp in listUpdate) { rp.Status = "present"; } //Act var result = await attendanceDAO.UpdateAttendance(listUpdate); //Assert Assert.Equal((int)HttpStatusCode.OK, ((ObjectResult)result).StatusCode); foreach (var rp in listUpdate) { Assert.Equal("present", rp.Status); } }
public int UpdateAttendanceById(int id, int attend) { AttendanceDAO attendance = new AttendanceDAO(); return(attendance.UpdateAttendance(id, attend)); }