예제 #1
0
 public Aluno Update(Aluno aluno)
 {
     DbEntityEntry entry = context.Entry(aluno);
     entry.State = EntityState.Modified;
     context.SaveChanges();
     return aluno;
 }
예제 #2
0
 public void AlunoQtdeCreditoInvalidTest()
 {
     Aluno aluno = new Aluno();
     aluno.Nome = "Elyacir Moro";
     aluno.QtdeCredito = 10;
     Validator.Validate(aluno);
 }
예제 #3
0
        public Aluno Update(Aluno aluno)
        {
            Validator.Validate(aluno);

            var updatedAluno = _repository.Update(aluno);

            return updatedAluno;
        }
예제 #4
0
        public Aluno Create(Aluno aluno)
        {
            Validator.Validate(aluno);

            _repository.Save(aluno);

            return aluno;
        }
예제 #5
0
 private void button1_Click(object sender, EventArgs e)
 {
     Aluno aluno = new Aluno();
        aluno.Nome = textAluno.Text;
        aluno.Cpf = textCPF.Text;
        aluno.Matricula = textMatricula.Text;
        aluno.QtdeCredito = Convert.ToInt32(textCreditos.Text);
        aluno.Curso = _cursos.Where(c => c.Nome.Equals(comboCurso.SelectedItem.ToString())).FirstOrDefault();
        AlunoService service = new AlunoService(new AlunoRepository());
        service.Create(aluno);
 }
예제 #6
0
        public void Setup()
        {
            Database.SetInitializer(new DropCreateDatabaseAlways<AlunoContext>());

            _repository = new AlunoRepository();
            _aluno = ObjectMother.GetAluno();

            AlunoContext context = new AlunoContext();
            _aluno = context.Alunos.Add(_aluno);
            context.SaveChanges();
        }
예제 #7
0
        public void CreateAAlunoTest()
        {
            Aluno aluno = new Aluno();
            aluno.Id = 1;
            aluno.Nome = "Elyacir Moro";
            aluno.Cpf = "000.000.000-00";
            aluno.Matricula = "123";
            aluno.QtdeCredito = 20;
            aluno.Curso = new Curso
            {
                Nome = "Sistemas de Informação",
                Turno = "Noturno",
                QtdeMinimaCreditos = 12
            };

            Assert.AreEqual("", string.Empty);
        }
예제 #8
0
        public static Aluno GetAluno()
        {
            Aluno _aluno = new Aluno();
            //_aluno.Id = 1;
            _aluno.Nome = "Elyacir Moro";
            _aluno.Cpf = "000.000.000-00";
            _aluno.Matricula = "123";
            _aluno.QtdeCredito = 20;
            _aluno.Curso = new Curso
            {
                //Id = 1,
                Nome = "Sistemas de Informação",
                Turno = "Noturno",
                QtdeMinimaCreditos = 12
            };

            return _aluno;
        }
예제 #9
0
 public void AlunoNomeInvalidTest()
 {
     Aluno aluno = new Aluno();
     Validator.Validate(aluno);
 }
예제 #10
0
 public void AlunoCreatedInvalidTest()
 {
     Aluno aluno = new Aluno();
     aluno.Nome = "Elyacir Moro";
     Validator.Validate(aluno);
 }
예제 #11
0
 public Aluno Save(Aluno aluno)
 {
     var newAluno = context.Alunos.Add(aluno);
     context.SaveChanges();
     return newAluno;
 }
예제 #12
0
 public void Setup()
 {
     _aluno = ObjectMother.GetAluno();
 }