Exemplo n.º 1
0
        public void BuscarAgendamentoPorDataAgendadaComIdMedico()
        {
            // given
            Paciente paciente1 = new Paciente(Guid.NewGuid(), "Joao", "", DateTime.Now, "M", "123.456.789-12", "12.123.456-1", "(21)98764-5433", "*****@*****.**", 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   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());

            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", medico1, paciente2, null);


            var listaAgendamentos = new List <Agendamento>();

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

            this.agendamentoRepositoryMock.Setup(a => a.BuscarAgendamentoPorDataAgendadaComIdMedico(It.IsAny <DateTime>(), medico1.IdMedico)).Returns(listaAgendamentos);

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

            // when
            var listaAgendamentosRetorno = new List <AgendamentoListarViewModel>(agendamentoService.BuscarAgendamentoPorDataAgendadaComIdMedico(DateTime.Now, medico1.IdMedico.ToString()));

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