public void product_category_should_not_be_loaded_before_called() { var myDao = new ProductDao(mySession); var myProduct = myDao.GetById(1); var isInitialized = NHibernateUtil.IsInitialized(myProduct.Categories); Assert.IsFalse(isInitialized); }
public void should_load_entities_only_once() { //Statistics should be on! var myDao = new ProductDao(mySession); var myProduct = myDao.GetById(1); var sameProductAgain = myDao.GetById(1); Assert.That(1 == mySession.Statistics.EntityCount); }
public void product_category_should_be_loaded_after_called() { var myDao = new ProductDao(mySession); var myProduct = myDao.GetById(1); var categoriesCount = myProduct.Categories.Count; var isInitialized = NHibernateUtil.IsInitialized(myProduct.Categories); Assert.IsTrue(isInitialized); }
protected void Page_Load(object sender, EventArgs e) { ProductDao myDao = new ProductDao(); List<Product> allProducts = myDao.GetAllProducts(); foreach (Product myProduct in allProducts) { HtmlGenericControl li = new HtmlGenericControl("li"); HyperLink productLink = new HyperLink(); productLink.NavigateUrl = "ProductDetail.aspx?productId=" + myProduct.Id.ToString(); productLink.Text = myProduct.Name; li.Controls.Add(productLink); productList.Controls.Add(li); } }