Example #1
0
        public void Teste_EventoServico_CarregarPorSalaComIdInvalido_DeveSerThrowException()
        {
            _fakeSala.Setup(s => s.Id).Returns(0);
            _evento = ObjectMother.RetorneEventoExistenteOk(_fakeFuncionario.Object, _fakeSala.Object);
            _mockRepositorio.Setup(br => br.CarregarPorSala(_evento.Sala.Id));

            Action comparation = () => _servico.CarregarPorSala(_evento.Sala.Id);

            comparation.Should().Throw <IdentifierUndefinedException>();
            _mockRepositorio.VerifyNoOtherCalls();
        }
Example #2
0
        public void Teste_EventoIntegracao_CarregarPorSala_DeveSerOk()
        {
            int idRelacionado      = 2;
            int quantidadeEsperada = 1;

            _sala.Id = idRelacionado;
            Evento evento = ObjectMother.RetorneEventoExistenteOk(_funcionario, _sala);

            var listaEventos = _servico.CarregarPorSala(evento.Sala.Id);

            listaEventos.Should().NotBeNullOrEmpty();
            listaEventos.Count().Should().Be(quantidadeEsperada);
        }
Example #3
0
 public void Deletar(Sala sala)
 {
     if (sala.Id <= 0)
     {
         throw new IdentifierUndefinedException();
     }
     if (_eventoServico.CarregarPorSala(sala.Id).Count() > 0)
     {
         throw new SalaRelacionadaComEventoException();
     }
     _salaRepositorio.Deletar(sala);
 }