コード例 #1
0
ファイル: UnitTest1.cs プロジェクト: Chaldow/COVID_SQL
        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
ファイル: UnitTest1.cs プロジェクト: Chaldow/COVID_SQL
        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
ファイル: UnitTest1.cs プロジェクト: Chaldow/COVID_SQL
        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
ファイル: UnitTest1.cs プロジェクト: Chaldow/COVID_SQL
        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
ファイル: UnitTest1.cs プロジェクト: Chaldow/COVID_SQL
        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
ファイル: LoginRepository.cs プロジェクト: Chaldow/COVID_SQL
 public LoginRepository(COVID_Context _context)
 {
     context = _context;
 }