public void Aluno_Sistema_Aplicacao_Deletar_NaoDeveJogarExcecao() { aluno = ObjectMother.ObterAlunoValido(); aluno = servico.Salvar(aluno); servico.Deletar(aluno); var alunoDeletada = servico.PegarPorId(aluno.Id); alunoDeletada.Should().BeNull(); }
public void Aluno_Aplicacao_Deletar_NaoDeveJogarExcecao() { aluno.Id = 1; repositorio.Setup(ar => ar.Deletar(aluno)); repositorio.Setup(ar => ar.PegarPorId(aluno.Id)); Action acao = () => servico.Deletar(aluno); var alunoDeletada = servico.PegarPorId(aluno.Id); acao.Should().NotThrow <Exception>(); alunoDeletada.Should().BeNull(); repositorio.Verify(ar => ar.Deletar(aluno)); repositorio.Verify(ar => ar.PegarPorId(aluno.Id)); repositorio.VerifyNoOtherCalls(); }
public void Aluno_Servico_Deletar_DeveDeletarOk() { aluno = ObjectMother.ObterAlunoValido(); repositorio.Setup(m => m.Salvar(aluno)).Returns(new Aluno { Id = 1 }); repositorio.Setup(m => m.Deletar(aluno)); aluno = servico.Salvar(aluno); servico.Deletar(aluno); aluno = servico.PegarPorId(aluno.Id); aluno.Should().BeNull(); repositorio.Verify(m => m.Deletar(aluno)); repositorio.Verify(m => m.Salvar(aluno)); repositorio.VerifyNoOtherCalls(); }