public void ShouldDeleteCustomer() { var id = Guid.Parse("199b9325-8c2b-468d-a1cc-9b6020192e0d"); var queryresult = _sut.Get(id); _sut.Delete(queryresult); _sut.Save(); var all = _sut.GetAll("").ToList(); Assert.Single(all); }
public IActionResult DeleteCustomer(Guid id) { var customerFromRepo = _talaCustomerRepository.Get(id); if (customerFromRepo == null) { return(NotFound()); } _talaCustomerRepository.Delete(customerFromRepo); if (!_talaCustomerRepository.Save()) { throw new Exception($"Deleting customer {id} failed on save"); } return(NoContent()); }