Пример #1
0
        public void BuscarAgendamentoComFiltroTest()
        {
            //given
            Paciente paciente1 = new Paciente(Guid.NewGuid(), "Joao", "", DateTime.Now, "M", "123.456.789-12", "12.123.456-1", "(21)98764-5433", "*****@*****.**", Guid.NewGuid());
            Medico   medico1   = new Medico(Guid.NewGuid(), "Marcos", "123.456.789-12", "12.345.678-1", 1214567, new DateTime(1980, 3, 6), "M", "(34)98543-3241", "*****@*****.**", Guid.NewGuid());
            Paciente paciente2 = new Paciente(Guid.NewGuid(), "Joice", "", DateTime.Now, "F", "121.456.789-12", "15.123.456-1", "(21)98767-5433", "*****@*****.**", Guid.NewGuid());
            Medico   medico2   = new Medico(Guid.NewGuid(), "Joana", "125.456.719-12", "11.345.678-9", 1233567, new DateTime(1980, 9, 1), "F", "(35)91543-3241", "*****@*****.**", Guid.NewGuid());

            Agendamento agendamento1 = new Agendamento(Guid.NewGuid(), DateTime.Now, DateTime.Now, "Nada", medico1, paciente1, null);
            Agendamento agendamento2 = new Agendamento(Guid.NewGuid(), DateTime.Now, DateTime.Now, "Nenhuma", medico2, paciente2, null);


            var listaAgendamentos = new List <Agendamento>();

            listaAgendamentos.Add(agendamento1);
            listaAgendamentos.Add(agendamento2);

            this.agendamentoRepositoryMock.Setup(a => a.BuscarAgendamentoSemConsultaComFiltro(It.IsAny <DateTime>(), It.IsAny <DateTime>(), It.IsAny <Guid>(), It.IsAny <Guid>())).Returns(listaAgendamentos);

            var agendamentoService = new AgendamentoService(this.agendamentoRepositoryMock.Object, this.consultaRepositoryMock.Object);

            // when
            var listaAgendamentosRetorno = new List <AgendamentoListarViewModel>(agendamentoService.BuscarAgendamentoComFiltro(DateTime.Now, DateTime.Now, "naoha", "naoha"));

            // then
            Assert.NotNull(listaAgendamentosRetorno);
            Assert.True(listaAgendamentosRetorno.Count == listaAgendamentos.Count);
        }