public async Task <int> RemovePayeeAsync(int id) { var payee = _context.GetPayees().SingleOrDefault(p => p.ID == id); if (payee != null) { _context.DeletePayee(payee); } return(await _context.SaveChangesAsync()); }
public void DeletePayee_calls_EfCore_Remove() { // Arrange var mockPayeeSet = new Mock <DbSet <Payee> >(); _mockContext.SetupGet(m => m.Payees).Returns(mockPayeeSet.Object); var testPayee = new Payee(); // Act _testRepo.DeletePayee(testPayee); // Assert mockPayeeSet.Verify(m => m.Remove(testPayee), Times.Once()); }