예제 #1
0
        public void Cliente_servico_pegar_por_id_deve_falhar_por_id_igual_zero()
        {
            var id        = 0;
            var cliente   = ObjectMother.ClienteValido();
            var exception = new NaoEncontradoException();

            Action action = () => _servico.PegarPorId(id);

            action.Should().Throw <NaoEncontradoException>();
        }
        public void Conta_servico_pegarPorId_deve_falhar_por_id_zerado()
        {
            var conta = ObjectMother.ObtemContaValida();

            conta.Id = 0;
            var exception = new NaoEncontradoException();

            Action action = () => _servico.PegarPorId(conta.Id);

            action.Should().Throw <NaoEncontradoException>();
        }
        public void Conta_servico_pegarPorId_deve_falhar_por_id_nao_encontrado()
        {
            var conta     = ObjectMother.ObtemContaValida();
            var exception = new NaoEncontradoException();

            _repositorio.Setup(pr => pr.PegarPorId(conta.Id)).Throws(exception);

            Action action = () => _servico.PegarPorId(conta.Id);

            action.Should().Throw <NaoEncontradoException>();

            _repositorio.Verify(pr => pr.PegarPorId(conta.Id), Times.Once);
        }
예제 #4
0
        public void Cliente_servico_pegar_por_id_deve_falhar_por_id_nao_encontrado()
        {
            var id        = 999;
            var cliente   = ObjectMother.ClienteValido();
            var exception = new NaoEncontradoException();

            _clienteRepositorioFake.Setup(pr => pr.PegarPorId(id)).Throws(exception);

            Action action = () => _servico.PegarPorId(id);

            action.Should().Throw <NaoEncontradoException>();

            _clienteRepositorioFake.Verify(pr => pr.PegarPorId(id), Times.Once);
        }