Пример #1
0
        public void AgendamentoService_Obter_DeveSerValido()
        {
            //Cenário
            Funcionario funcionario = new Funcionario();

            funcionario.Id = 1;
            Sala sala = new Sala();

            sala.Id = 1;
            Agendamento agendamento = ObjectMother.ObterAgendamentoValido();

            agendamento.Id          = 1;
            agendamento.Funcionario = funcionario;
            agendamento.Sala        = sala;

            _mockAgendamentoRepositorio.Setup(rp => rp.Obter(agendamento.Id)).Returns(new Agendamento {
                Id = 1, HoraInicial = DateTime.Now.AddHours(1), HoraFinal = DateTime.Now.AddHours(2), Funcionario = funcionario, Sala = sala
            });

            //Ação
            Agendamento retorno = _agendamentoService.Obter(agendamento.Id);

            //Verificar
            _mockAgendamentoRepositorio.Verify(rp => rp.Obter(agendamento.Id));

            retorno.Should().NotBeNull();
            retorno.Id.Should().BeGreaterThan(0);
        }
Пример #2
0
        public void AgendamentoIntegracaoSistema_Adicionar_DeveSerValido()
        {
            //Cenário
            Sala sala = new Sala();

            sala.Id = 1;
            Funcionario funcionario = new Funcionario();

            funcionario.Id = 1;
            Agendamento agendamento = ObjectMother.ObterAgendamentoValido();

            agendamento.Id          = 0;
            agendamento.Sala        = sala;
            agendamento.Funcionario = funcionario;

            //Ação
            Agendamento agendamentoResultado = _agendamentoService.Adicionar(agendamento);

            //Verificar
            agendamentoResultado.Should().NotBeNull();
            agendamentoResultado.Id.Should().BeGreaterThan(0);
            agendamentoResultado.Sala.Should().Be(agendamento.Sala);
            agendamentoResultado.Funcionario.Should().Be(agendamento.Funcionario);
            agendamentoResultado.HoraInicial.Should().BeBefore(DateTime.Now.AddDays(1));
            agendamentoResultado.HoraFinal.Should().BeBefore(DateTime.Now.AddDays(2));

            Agendamento agendamentoGet = _agendamentoService.Obter(agendamentoResultado.Id);

            agendamentoResultado.Id.Should().Be(agendamentoGet.Id);

            _agendamentoService.Excluir(agendamentoResultado);
        }