public async Task TravelAttachmentRepository_DeleteTravelAttachment_Deleted_NotFail_Test() { var context = new MyCompanyContext(); ITravelAttachmentRepository target = new TravelAttachmentRepository(new MyCompanyContext()); var travelRequestId = context.TravelRequests.FirstOrDefault().TravelRequestId; System.Text.ASCIIEncoding encoder = new System.Text.ASCIIEncoding(); var newTravelAttachment = new TravelAttachment() { Name = "Boarding Pass", FileName = "BoardingPass.pdf", Content = encoder.GetBytes("sample"), TravelRequestId = travelRequestId, }; int travelAttachmentId = await target.AddAsync(newTravelAttachment); int expected = context.TravelAttachments.Count() - 1; await target.DeleteAsync(travelAttachmentId); int actual = context.TravelAttachments.Count(); Assert.AreEqual(expected, actual); }
public async Task TravelAttachmentRepository_DeleteTravelAttachment_NoExists_NotFail_Test() { var context = new MyCompanyContext(); int expected = context.TravelAttachments.Count(); ITravelAttachmentRepository target = new TravelAttachmentRepository(new MyCompanyContext()); await target.DeleteAsync(-1); int actual = context.TravelAttachments.Count(); Assert.AreEqual(expected, actual); }