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()); }
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()); }
// GET: api/Turma public IEnumerable <TurmaDTO> Get() { return(_turmaService.GetAll()); }