Ejemplo n.º 1
0
        public void Persistir_Turma_Service_Test()
        {
            var repo    = Injection.Get <ITurmaRepository>();
            var uow     = Injection.Get <IUnitOfWork>();
            var service = new TurmaService(repo, uow);

            service.Add(new TurmaDTO(ObjectBuilder.CreateTurma()));

            var turmas = service.GetAll();

            Assert.IsTrue(turmas.Count > 1);
            Assert.IsTrue((uow as Infrastructure.DAO.ORM.Common.EntityFrameworkUnitOfWork).Test() == (repo as NDDigital.DiarioAcademia.Infraestrutura.Orm.Repositories.TurmaRepositoryEF).Test());
        }
Ejemplo n.º 2
0
        public void Deveria_Chamar_Servico_de_Buscar_Todas_Turmas_Test()
        {
            //arrange
            var turmas = new List <Turma>()
            {
                ObjectBuilder.CreateTurma()
            };

            TurmaRepository
            .Setup(x => x.GetAll())
            .Returns(turmas);

            //act
            TurmaService.GetAll();

            //assert
            TurmaRepository.Verify(x => x.GetAll(), Times.Once());
        }
Ejemplo n.º 3
0
 // GET: api/Turma
 public IEnumerable <TurmaDTO> Get()
 {
     return(_turmaService.GetAll());
 }