public override void Handle(BrokeredMessage message) { var employeePictureRepository = new EmployeePictureRepository(new MyCompanyContext()); var employeePictureId = message.GetBody <int>(); employeePictureRepository.DeleteAsync(employeePictureId).Wait(); }
public async Task EmployeePictureRepository_DeleteEmployeePicture_NoExists_NotFail_Test() { var context = new MyCompanyContext(); int expected = context.EmployeePictures.Count(); IEmployeePictureRepository target = new EmployeePictureRepository(context); await target.DeleteAsync(0); int actual = context.EmployeePictures.Count(); Assert.AreEqual(expected, actual); }
public async Task EmployeePictureRepository_DeleteEmployeePicture_Deleted_NotFail_Test() { var context = new MyCompanyContext(); var employeePicture = context.EmployeePictures.First(); int expected = context.EmployeePictures.Count() - 1; IEmployeePictureRepository target = new EmployeePictureRepository(new MyCompanyContext()); await target.DeleteAsync(employeePicture.EmployeePictureId); int actual = context.EmployeePictures.Count(); Assert.AreEqual(expected, actual); }