Пример #1
0
        public void TesteIdadeNegativa()
        {
            Paciente novoPaciente = new Paciente();

            novoPaciente.idade = -12;
            COVID_Context      context            = new COVID_Context();
            PacienteRepository pacienteRepository = new PacienteRepository(context);
            PacienteService    _service           = new PacienteService(pacienteRepository);
            var ex = Assert.Throws <Exception>(() => _service.inserir(novoPaciente));

            Assert.That(ex.Message, Is.EqualTo("Idade não válida"));
        }
Пример #2
0
        public void TesteIdadeMaxima()
        {
            Paciente novoPaciente = new Paciente();

            novoPaciente.idade = 130;
            COVID_Context      context            = new COVID_Context();
            PacienteRepository pacienteRepository = new PacienteRepository(context);
            PacienteService    _service           = new PacienteService(pacienteRepository);
            var ex = Assert.Throws <Exception>(() => _service.inserir(novoPaciente));

            Assert.That(ex.Message, Is.EqualTo("Idade acima do limite"));
        }
Пример #3
0
        public void TesteNomeVazio()
        {
            Paciente novoPaciente = new Paciente();

            novoPaciente.nome = "";
            COVID_Context      context            = new COVID_Context();
            PacienteRepository pacienteRepository = new PacienteRepository(context);
            PacienteService    _service           = new PacienteService(pacienteRepository);
            var ex = Assert.Throws <Exception>(() => _service.inserir(novoPaciente));

            Assert.That(ex.Message, Is.EqualTo("Nome Obrigatório"));
        }
Пример #4
0
        public void TestePacienteCPF()
        {
            Paciente novoPaciente = new Paciente();

            novoPaciente.cpf = "113227126900";
            COVID_Context      context            = new COVID_Context();
            PacienteRepository pacienteRepository = new PacienteRepository(context);
            PacienteService    _service           = new PacienteService(pacienteRepository);
            var ex = Assert.Throws <Exception>(() => _service.inserir(novoPaciente));

            Assert.That(ex.Message, Is.EqualTo("Já existente"));
        }
Пример #5
0
        public void InserirNovoPaciente()
        {
            Paciente novoPaciente = new Paciente();

            novoPaciente.nome = "Nunes";
            COVID_Context      context            = new COVID_Context();
            PacienteRepository pacienteRepository = new PacienteRepository(context);
            PacienteService    _service           = new PacienteService(pacienteRepository);
            int retorno = _service.inserir(novoPaciente);

            Assert.Greater(retorno, 0);
        }
Пример #6
0
 public PacienteRepository(COVID_Context _context)
 {
     context = _context;
 }
Пример #7
0
 public LoginRepository(COVID_Context _context)
 {
     context = _context;
 }