public void GetByGroupTest() { var fromDb = new SubGroupRepository().GetByGroup(grupo); Assert.IsNotNull(fromDb); Assert.IsTrue(fromDb.Count > 0); }
public void AddTest() { SubGrupo item = new SubGrupo() { Descricao = "SubGrupo01", Grupo = grupo }; ISubGroupRepository target = new SubGroupRepository(); target.Add(item); try { // use session to try to load the product using (ISession session = NHibernateHelper.OpenSession()) { var fromDb = session.Get <SubGrupo>(item.Id); Assert.IsNotNull(fromDb); Assert.AreNotSame(item, fromDb); Assert.AreEqual(item.Descricao, fromDb.Descricao); Assert.IsNotNull(fromDb.Grupo); Assert.AreEqual(item.Grupo.Descricao, fromDb.Grupo.Descricao); } } finally { target.Remove(item); } }
public LmPlatformRepositoriesContainer() { UsersRepository = new UsersRepository(_dataContext); BugsRepository = new BugsRepository(_dataContext); BugLogsRepository = new BugLogsRepository(_dataContext); GroupsRepository = new GroupsRepository(_dataContext); ProjectsRepository = new ProjectsRepository(_dataContext); ProjectUsersRepository = new ProjectUsersRepository(_dataContext); ProjectCommentsRepository = new ProjectCommentsRepository(_dataContext); StudentsRepository = new StudentsRepository(_dataContext); SubjectRepository = new SubjectRepository(_dataContext); TestsRepository = new TestsRepository(_dataContext); TestUnlocksRepository = new TestUnlockRepository(_dataContext); QuestionsRepository = new QuestionsRepository(_dataContext); UsersRepository = new UsersRepository(_dataContext); ModulesRepository = new ModulesRepository(_dataContext); LecturerRepository = new LecturerRepository(_dataContext); MessageRepository = new MessageRepository(_dataContext); MaterialsRepository = new MaterialsRepository(_dataContext); FoldersRepository = new FoldersRepository(_dataContext); SubGroupRepository = new SubGroupRepository(_dataContext); AttachmentRepository = new AttachmentRepository(_dataContext); LecturesRepository = new LecturesRepository(_dataContext); LabsRepository = new LabsRepository(_dataContext); ProjectUsersRepository = new ProjectUsersRepository(_dataContext); PracticalRepository = new PracticalRepository(_dataContext); ConceptRepository = new ConceptRepository(_dataContext); WatchingTimeRepository = new WatchingTimeRepository(_dataContext); TestQuestionPassResultsRepository = new TestQuestionPassResultsRepository(_dataContext); //todo UNUSED ProjectMatrixRequirementsRepository = new ProjectMatrixRequirementsRepository(_dataContext); }
public void GetByDescriptionTest() { var fromDb = new SubGroupRepository().GetByDescription(item.Descricao); Assert.IsNotNull(fromDb); Assert.AreNotSame(item, fromDb); Assert.AreEqual(item.Descricao, fromDb.Descricao); Assert.IsNotNull(fromDb.Grupo); Assert.AreEqual(item.Grupo.Descricao, fromDb.Grupo.Descricao); }
public MainViewModel(ShopNetworkContext dbCont) { _subGroupRepository = new SubGroupRepository(dbCont); _groupRepository = new GroupRepository(dbCont); _personRepository = new PersonRepository(dbCont); _pictureRepository = new PictureRepository(dbCont); _adminRepository = new AdminRepository(dbCont); _discountRepository = new DiscountRepository(dbCont); _productRepository = new ProductRepository(dbCont); _newsRepository = new NewsRepository(dbCont); _cartRepository = new CartRepository(dbCont); }
public CatalogViewModel(ProductRepository productRepository, GroupRepository groupRepository, SubGroupRepository subGroupRepository, CartRepository cartRepository, AdminRepository adminRepository, PersonRepository personRepository, CatalogView catalogView, MainViewModel mainViewModel) { _productRepository = productRepository; _groupRepository = groupRepository; _subGroupRepository = subGroupRepository; _cartRepository = cartRepository; _adminRepository = adminRepository; _personRepository = personRepository; _catalogView = catalogView; _products = new ObservableCollection <Product>(_productRepository.GetWithInclude(x => x.PictureID, x => x.Discount, x => x.SubGroup, x => x.Carts)); _mainViewModel = mainViewModel; }
public async Task <IEnumerable <SubGroup> > GettblSubGroups() { SubGroupRepo = new SubGroupRepository(context); return(await SubGroupRepo.GetRecords()); }