public bool CriarAgendamento(AgendamentoViewModel agendamentoViewModel)
        {
            FabricaDeAgendamento fabricaDeAgendamento = new FabricaDeAgendamento();
            Agendamento agendamento =  fabricaDeAgendamento.InformarCID(agendamentoViewModel.numeroCID)
                .InformarMedico(agendamentoViewModel.crm)
                .InformarPaciente(agendamentoViewModel.cpf)
                .Criar();

            _agendamentos.Gravar(agendamento);

            EventosDoDominio.Disparar(new AgendamentoCriado(agendamentoViewModel));

            return true;
        }
Example #2
0
        public void ComoAtendenteQueroPersistirUmAgendamento()
        {
            //Arrange
            IAgendamentos agendamentos = new AgendamentosFake();

            FabricaDeAgendamento fabricaDeAgendamento = new FabricaDeAgendamento();

            //act

            Agendamento agendamento =
                fabricaDeAgendamento.
                InformarPaciente("2345").
                InformarMedico("1234").
                InformarCID("21-9").
                Criar();

            //Act
            var retorno = agendamentos.Gravar(agendamento);

            //Assert
            Assert.IsTrue(retorno);
        }
Example #3
0
        public void ComoDesenvolvedorQueroUmaFabricaDeAgendamento()
        {
            //arrange
            FabricaDeAgendamento fabricaDeAgendamento = new FabricaDeAgendamento();

            //act

            Agendamento agendamento =
                fabricaDeAgendamento.
                InformarPaciente("2345").
                InformarMedico("1234").
                InformarCID("21-9").
                Criar();

            //assert

            Assert.IsTrue(agendamento.Medico.Crm == "1234");
            Assert.IsTrue(agendamento.Paciente.Cpf == "2345");
            Assert.IsTrue(agendamento.Cid.Numero == "21-9");
        }