예제 #1
0
        public void GetFirst_not_null_value_match()
        {
            var query  = Prepare.GetQuery();
            var result = query.GetFirst(a => a.Index > 2);

            Assert.NotNull(result);
            Assert.Equal(3, result.Index);
        }
예제 #2
0
        public void Delete_all_success()
        {
            var query = Prepare.SetQuery();

            var result = query.Delete(a => a.Index < 100);

            Assert.True(result);
        }
예제 #3
0
        public void GetBottom_not_null_value_match()
        {
            var query  = Prepare.GetQuery();
            var result = query.GetBottom(a => a.Index >= 5, k => k.Index);

            Assert.NotNull(result);
            Assert.Equal(5, result.Index);
        }
예제 #4
0
        public void GetTop_not_null_value_match()
        {
            var query  = Prepare.GetQuery();
            var result = query.GetTop(a => a.Index >= 5 && a.Index < 12, k => k.Index);

            Assert.NotNull(result);
            Assert.Equal(11, result.Index);
        }
예제 #5
0
        public void Insert_success()
        {
            var query  = Prepare.SetQuery();
            var result = query.Insert(
                new Author {
                Name = "Isaac Asimov", Description = "Sci-fi", Index = 4
            });

            Assert.True(result);
        }
예제 #6
0
        public void Update_all_one_success()
        {
            var query     = Prepare.SetQuery();
            var newAuthor = Prepare.GetQuery().GetFirst(a => a.Index == 11);

            newAuthor.Description = "Greg Bear changed";
            newAuthor.Name        = "James Patterson";
            var result = query.Update(a => a.Index == 11, newAuthor);

            Assert.True(result);
        }
예제 #7
0
        public void GetRange_not_null_count()
        {
            var query  = Prepare.GetQuery();
            var all    = query.GetRange((2, 3));
            var notall = query.GetRange((2, 3), a => a.Index > 0 && a.Index <= 6);

            Assert.NotNull(all);
            Assert.Equal(3, all.Count);

            Assert.NotNull(notall);
            Assert.Equal(3, notall.Count);
        }
예제 #8
0
        public void GetDescendingOrderedList_not_null_count()
        {
            var query  = Prepare.GetQuery();
            var all    = query.GetDescendingOrderedList(k => k.Name);
            var notall = query.GetDescendingOrderedList(k => k.Name, a => a.Index > 0 && a.Index <= 6);

            Assert.NotNull(all);
            Assert.True(all.Count >= 10);

            Assert.NotNull(notall);
            Assert.Equal(6, notall.Count);
        }
예제 #9
0
        public void GetList_not_null_count()
        {
            var query  = Prepare.GetQuery();
            var all    = query.GetList();
            var notall = query.GetList(a => a.Name.Contains("Isaac Asimov"));

            Assert.NotNull(all);
            Assert.True(all.Count >= 11);

            Assert.NotNull(notall);
            Assert.Equal(2, notall.Count);
        }
예제 #10
0
        public void InsertBulk_success()
        {
            var query   = Prepare.SetQuery();
            var newList = new List <Author> {
                new Author {
                    Name        = "Frank Herbert",
                    Index       = 1,
                    Description = "SciFi"
                },
                new Author {
                    Name        = "Isaac Asimov",
                    Index       = 2,
                    Description = "SciFi"
                },
                new Author {
                    Name        = "Robert A Heinlein",
                    Index       = 3,
                    Description = "SciFi"
                },
                new Author {
                    Name        = "Rebert Silverberg",
                    Index       = 4,
                    Description = "SciFi"
                },
                new Author {
                    Name        = "Greg Bear",
                    Index       = 5,
                    Description = "SciFi"
                },
                new Author {
                    Name        = "Greg Bear",
                    Index       = 6,
                    Description = "SciFi"
                },
                new Author {
                    Name        = "Frank Herbert",
                    Index       = 7,
                    Description = "SciFi"
                },
                new Author {
                    Name        = "Isaac Asimov",
                    Index       = 8,
                    Description = "SciFi"
                },
                new Author {
                    Name        = "Robert A Heinlein",
                    Index       = 9,
                    Description = "SciFi"
                },
                new Author {
                    Name        = "Rebert Silverberg",
                    Index       = 10,
                    Description = "SciFi"
                },
                new Author {
                    Name        = "Greg Bear",
                    Index       = 11,
                    Description = "SciFi"
                }
            };
            var result = query.InsertBulk(newList);

            Assert.True(result);
        }