public async Task <IActionResult> DeleteClient([FromRoute] string clientIdString) { Guid clientId; try { clientId = Guid.Parse(clientIdString); } catch (FormatException) { return(BadRequest()); } await insuranceService.DeleteClientAsync(clientId); return(Ok()); }
public async Task DeletingAClientMustDeleteAllAssignmentsAndCallThroughToTheRepository() { var policy = new InsurancePolicy(Guid.NewGuid(), "123", "123", new Dictionary <InsuranceCoverage, float>(), DateTime.Now, 10, 10, RiskLevel.Low); var client = new Client(Guid.NewGuid(), "Carlos", new[] { policy }); repoMock .Setup(mock => mock.GetClientAsync(client.Id)) .ReturnsAsync(client); repoMock .Setup(mock => mock.DeleteClientAssignmentAsync(policy.Id, client.Id)) .Returns(Task.CompletedTask); repoMock .Setup(mock => mock.DeleteClientAsync(client.Id)) .Returns(Task.CompletedTask); await service.DeleteClientAsync(client.Id); repoMock.Verify(); }