public async Task VisitRepository_DeleteVisit_Deleted_NotFail_Test() { var context = new MyCompanyContext(); IVisitRepository target = new VisitRepository(context); var employeeId = context.Employees.FirstOrDefault().EmployeeId; var visitorId = context.Visitors.FirstOrDefault().VisitorId; var newVisit = new Visit() { CreatedDateTime = DateTime.UtcNow, VisitDateTime = DateTime.UtcNow.AddDays(2), Comments = "Comments", EmployeeId = employeeId, HasCar = true, Plate = "AAA-BBBB", VisitorId = visitorId, }; int visitId = await target.AddAsync(newVisit); int expected = context.Visits.Count() - 1; await target.DeleteAsync(visitId); int actual = context.Visits.Count(); Assert.AreEqual(expected, actual); }
public async Task VisitRepository_DeleteVisit_NoExists_NotFail_Test() { var context = new MyCompanyContext(); int expected = context.Visits.Count(); IVisitRepository target = new VisitRepository(context); await target.DeleteAsync(-1); int actual = context.Visits.Count(); Assert.AreEqual(expected, actual); }