コード例 #1
0
        public void DeletePosts()
        {
            var posts = PostHydrador.GetList(1000);
            Bridge.InsertRange(posts);

            Bridge.DeleteRange(posts.Select(o => o.Id));
        }
コード例 #2
0
        public void DeletePost()
        {
            var post = PostHydrador.GetSingle();
            Bridge.Insert(post);

            Bridge.Delete(post.Id);
        }
コード例 #3
0
        public void UpdatePost()
        {
            var post = PostHydrador.GetSingle();

            Bridge.Insert(post);

            post.Title = "Changed title!";

            Bridge.Update(post.Id, post);
        }
コード例 #4
0
        public void GetPost()
        {
            var post = PostHydrador.GetSingle();

            Bridge.Insert(post);

            var receivedPost = Bridge.Get <Post>(post.Id);

            Assert.IsNotNull(receivedPost);
            Assert.AreEqual(post.Id, receivedPost.Id);
        }
コード例 #5
0
        public void UpdatePost()
        {
            var post = PostHydrador.GetSingle();
            Bridge.Insert(post);

            post.Title = "Changed title!";

            Bridge.Update(post.Id, post);

            post = Bridge.Get(post.Id) as Post;
            Assert.AreEqual("Changed title!", post.Title);
        }
コード例 #6
0
        public void GetPagedPosts()
        {
            var posts = PostHydrador.GetList(50);

            Bridge.InsertRange(posts);

            var range         = Bridge.Query <Post>();
            var receivedPosts = range
                                .Page(20)
                                .ToList();

            Assert.IsNotNull(receivedPosts);
            Assert.AreEqual(20, receivedPosts.Count);
        }
コード例 #7
0
        public void GetPosts()
        {
            var range      = Bridge.Query <Post>();
            int startCount = range.Count();

            var posts = PostHydrador.GetList(1000);

            Bridge.InsertRange(posts);

            var receivedPosts = range.ToList();

            Assert.IsNotNull(receivedPosts);
            Assert.AreEqual(posts.Count, receivedPosts.Count - startCount);
        }
コード例 #8
0
        public void UpdatePostUpdatesIndexes()
        {
            var post = PostHydrador.GetSingle();
            Bridge.Insert(post);

            post.Title = "Changed title!";

            Bridge.Update(post.Id, post);

            var match = Bridge.Query<Post>()
                .Filter(new Eq(new Field("Title"), new Literal("Changed title!")))
                .Count();

            Assert.AreEqual(1, match);
        }
コード例 #9
0
        public void GetTitledModels()
        {
            int startCount = Bridge.Query <Post>().Count();

            var titledModels = PostHydrador.GetList(800).Cast <ITitled>()
                               .Union(LinkHydrador.GetList(200))
                               .ToList();

            Bridge.InsertRange(titledModels);

            var receivedPosts = Bridge.Query <ITitled>().ToList();

            Assert.IsNotNull(receivedPosts);
            Assert.AreEqual(titledModels.Count, receivedPosts.Count - startCount);
        }
コード例 #10
0
        public void GetFilteredPosts()
        {
            int startCount = Bridge.Query <Post>().Count();

            var posts = PostHydrador.GetList(1000);

            Bridge.InsertRange(posts);

            string contentFullName = typeof(IContent).FullName;
            var    receivedPosts   = Bridge.Query <Post>()
                                     .Filter(new And(
                                                 leftFilter: new Eq(new Field("Title"), new Literal(posts.First().Title)),
                                                 rightFilter: new Eq(new Field("Author"), new Literal(posts.First().Author))
                                                 ))
                                     .ToList();

            Assert.IsNotNull(receivedPosts);
            Assert.AreEqual(1, receivedPosts.Count);
        }
コード例 #11
0
        public void InsertPosts()
        {
            var posts = PostHydrador.GetList(1000);

            Bridge.InsertRange(posts);
        }
コード例 #12
0
        public void InsertPost()
        {
            var post = PostHydrador.GetSingle();

            Bridge.Insert(post);
        }