Example #1
0
        public List <TurmaViewModel> Search(TurmaSearchModel searchModel)
        {
            var Turmas = TurmaRepository.GetAll();


            return(Filter(Turmas, searchModel).Select(selectClauseTurma).ToList());
        }
Example #2
0
        public void Deveria_Persistir_Turma_ORM_Test()
        {
            var turma = ObjectBuilder.CreateTurma();

            TurmaRepository.Add(turma);

            Uow.Commit();

            var qtdTurmas = TurmaRepository.GetAll().Count;

            Assert.AreEqual(2, qtdTurmas);
        }
Example #3
0
        public void Deveria_Persistir_Turma_SQL_Test()
        {
            var turma = ObjectBuilder.CreateTurma();

            var qtdTurmasBefore = TurmaRepository.GetAll().Count;

            TurmaRepository.Add(turma);

            var qtdTurmasAfter = TurmaRepository.GetAll().Count;

            Uow.Commit();

            Assert.AreEqual(qtdTurmasBefore + 1, qtdTurmasAfter);
        }
Example #4
0
        public void Deveria_Remover_Turma_SQL_Test()
        {
            var turma = ObjectBuilder.CreateTurma();

            TurmaRepository.Add(turma);

            Uow.Commit();

            var qtdTurmasBefore = TurmaRepository.GetAll().Count;

            TurmaRepository.Delete(turma.Id);

            Uow.Commit();

            var qtdTurmasAfter = TurmaRepository.GetAll().Count;

            Assert.AreEqual(qtdTurmasBefore - 1, qtdTurmasAfter);
        }
Example #5
0
        public void Deveria_Remover_Turma_ORM_Test()
        {
            var turma = ObjectBuilder.CreateTurma();

            TurmaRepository.Add(turma);
            Uow.Commit();

            var turmasEncontradas = TurmaRepository.GetAll();

            Assert.AreEqual(2, turmasEncontradas.Count);

            TurmaRepository.Delete(2);

            Uow.Commit();

            turmasEncontradas = TurmaRepository.GetAll();

            Assert.AreEqual(1, turmasEncontradas.Count);
        }
Example #6
0
        public async Task <ActionResult <List <Turma> > > GetAll([FromServices] EscolaDataContext context)
        {
            var turmas = await repository.GetAll();

            return(turmas);
        }
Example #7
0
        public void Deveria_Buscar_Todas_Turmas_SQL_Test()
        {
            var turmasEncontradas = TurmaRepository.GetAll();

            Assert.IsTrue(turmasEncontradas.Count > 0);
        }
Example #8
0
        public void Deveria_Buscar_Todas_Turmas_ORM_Test()
        {
            var turmasEncontradas = TurmaRepository.GetAll();

            Assert.AreEqual(1, turmasEncontradas.Count);
        }