protected override void OnSetUp() { base.OnSetUp(); using (ISession session = this.OpenSession()) { ArticleGroupItem agrp_1 = new ArticleGroupItem(); agrp_1.Name = "Article group 1"; session.Save(agrp_1); ArticleGroupItem agrp_2 = new ArticleGroupItem(); agrp_2.Name = "Article group 2"; session.Save(agrp_2); session.Flush(); ArticleItem article_1 = new ArticleItem(); article_1.Articlegroup = agrp_1; article_1.Name = "Article 1 grp 1"; article_1.IsFavorite = 0; session.Save("Article", article_1); ArticleItem article_2 = new ArticleItem(); article_2.Articlegroup = agrp_1; article_2.Name = "Article 2 grp 1"; article_2.IsFavorite = 1; session.Save("Article", article_2); ArticleItem article_3 = new ArticleItem(); article_3.Articlegroup = agrp_2; article_3.Name = "Article 1 grp 2"; article_3.IsFavorite = 0; session.Save("Article", article_3); session.Flush(); } }
protected override void OnSetUp() { base.OnSetUp(); using (ISession session = this.OpenSession()) { ArticleGroupItem agrp_1 = new ArticleGroupItem(); agrp_1.Name = "Article group 1"; session.Save(agrp_1); ArticleGroupItem agrp_2 = new ArticleGroupItem(); agrp_2.Name = "Article group 2"; session.Save(agrp_2); session.Flush(); ArticleItem article_1 = new ArticleItem(); article_1.Articlegroup = agrp_1; article_1.Name = "Article 1 grp 1"; article_1.IsFavorite = 0; session.Save("Article", article_1); ArticleItem article_2 = new ArticleItem(); article_2.Articlegroup = agrp_1; article_2.Name = "Article 2 grp 1"; article_2.IsFavorite = 1; session.Save("Article", article_2); ArticleItem article_3 = new ArticleItem(); article_3.Articlegroup = agrp_2; article_3.Name = "Article 1 grp 2"; article_3.IsFavorite = 0; session.Save("Article", article_3); session.Flush(); } }
public void Can_GetListOfArticles() { string HQL; IList <ArticleItem> result; //add new using (ISession session = this.OpenSession()) { ArticleItem item = new ArticleItem(); item.Name = "Test article"; item.IsFavorite = 0; session.Save("Article", item); session.Flush(); } //here first problem, no entities are returned <======== HQL = "from Article"; using (ISession session = this.OpenSession()) { result = session.CreateQuery(HQL).List <ArticleItem>(); } Assert.That(result.Count, Is.GreaterThan(0)); }
public void Can_GetListOfArticles() { string HQL; IList<ArticleItem> result; //add new using (ISession session = this.OpenSession()) { ArticleItem item = new ArticleItem(); item.Name = "Test article"; item.IsFavorite = 0; session.Save("Article", item); session.Flush(); } //here first problem, no entities are returned <======== HQL = "from Article"; using (ISession session = this.OpenSession()) { result = session.CreateQuery(HQL).List<ArticleItem>(); } result.Count.Should().Be.GreaterThan(0); }