public void Manufacturers() { var manufacturer = new Manufacturers("Mój producent"); var conn = new NHibernateConnection(); var repo = new ManufacturersRepository(conn); //repo.Save(manufacturer); Manufacturers fromDB = repo.Get(2); //fromDB.Update("Nowa nazwa"); //repo.Update(fromDB); //Assert.IsFalse(fromDB.Name != "Nowa nazwa"); repo.Delete(fromDB); Manufacturers manufacturrer2 = repo.Get(2); Assert.IsNull(manufacturrer2); }
public void Products() { var conn = new NHibernateConnection(); var productRepo = new ProductsRepository(conn); var categoryRepo = new CategoryRepository(conn); var manufacturersRepository = new ManufacturersRepository(conn); Categories category = categoryRepo.Get(4); Manufacturers manufacturer = manufacturersRepository.Get(1); var product = new Products("Towar", "Jego opis", Convert.ToDecimal(125.99), category, manufacturer, 100, false, true, false, "Krótki opis"); productRepo.Save(product); Products fromDB = productRepo.Get(product.ID); Assert.AreEqual(product, fromDB); }