public void Service_Conta_Delete_DeveJogarExcessao_NotFoundException() { //Arrange var contaCmd = ContaObjectMother.GetContaValidaParaDeletar(); _repositoryFake.Setup(x => x.Delete(contaCmd.Id)).Throws <NotFoundException>(); //Action Action act = () => _service.Delete(contaCmd); //Assert act.Should().Throw <NotFoundException>(); _repositoryFake.Verify(pr => pr.Delete(contaCmd.Id), Times.Once); }
public void Service_Conta_Delete_DevePassar() { //Arrange var contaCmd = ContaObjectMother.GetContaValidaParaDeletar(); var removido = true; _repositoryFake.Setup(pr => pr.Delete(contaCmd.Id)).Returns(removido); //Action var contaRemovido = _service.Delete(contaCmd); //Assert _repositoryFake.Verify(pr => pr.Delete(contaCmd.Id), Times.Once); contaRemovido.Should().BeTrue(); }