Example #1
0
        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();
            }
        }
Example #2
0
		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();
			}
		}
Example #3
0
        public void Can_GetListOfArticleGroups()
        {
            string HQL;
            IList <ArticleGroupItem> result;

            //add new
            using (ISession session = this.OpenSession()) {
                ArticleGroupItem item = new ArticleGroupItem();
                item.Name = "Test article group";
                session.Save(item);
                session.Flush();
            }

            HQL = "from ArticleGroupItem";
            using (ISession session = this.OpenSession()) {
                result = session.CreateQuery(HQL).List <ArticleGroupItem>();
            }
            Assert.That(result.Count, Is.GreaterThan(0));
        }
Example #4
0
		public void Can_GetListOfArticleGroups()
		{
			string HQL;
			IList<ArticleGroupItem> result;

			//add new
			using (ISession session = this.OpenSession()) {
				ArticleGroupItem item = new ArticleGroupItem();
				item.Name = "Test article group";
				session.Save(item);
				session.Flush();
			}

			HQL = "from ArticleGroupItem";
			using (ISession session = this.OpenSession()) {
				result = session.CreateQuery(HQL).List<ArticleGroupItem>();
			}
			result.Count.Should().Be.GreaterThan(0);
		}
Example #5
0
        public async Task Can_GetListOfArticleGroupsAsync()
        {
            string HQL;
            IList <ArticleGroupItem> result;

            //add new
            using (ISession session = this.OpenSession()) {
                ArticleGroupItem item = new ArticleGroupItem();
                item.Name = "Test article group";
                await(session.SaveAsync(item));
                await(session.FlushAsync());
            }

            HQL = "from ArticleGroupItem";
            using (ISession session = this.OpenSession()) {
                result = await(session.CreateQuery(HQL).ListAsync <ArticleGroupItem>());
            }
            Assert.That(result.Count, Is.GreaterThan(0));
        }