Exemplo n.º 1
0
        public void TestWhereBoolNotConditionEquals()
        {
            var expected = "$filter=HasUniqueRoleAssignments eq false";

            var query = new ListItemCollection(null, null)
                        .Where(i => i.HasUniqueRoleAssignments == false);

            var result = query.ToString();

            Assert.AreEqual(expected, result);
        }
Exemplo n.º 2
0
        public void TestWhereStartsWith()
        {
            var expected = "$filter=startswith(Title,'Value') eq true";

            var query = new ListItemCollection(null, null)
                        .Where(i => i.Title.StartsWith("Value"));

            var result = query.ToString();

            Assert.AreEqual(result, expected);
        }
Exemplo n.º 3
0
        public void TestWhereYear()
        {
            var expected = "$filter=year(Date) eq 1";

            var query = new ListItemCollection(null, null)
                        .Where(i => ((DateTime)i.Values["Date"]).Year == 1);

            var result = query.ToString();

            Assert.AreEqual(result, expected);
        }
Exemplo n.º 4
0
        public void TestWhereContainsEquals()
        {
            var expected = "$filter=substringof('Value',Title) eq true";

            var query = new ListItemCollection(null, null)
                        .Where(i => i.Title.Contains("Value") == true);

            var result = query.ToString();

            Assert.AreEqual(result, expected);
        }
Exemplo n.º 5
0
        public void TestDoubleOr()
        {
            var expected = "$filter=(id eq 1 or Title eq 'title')";

            var query = new ListItemCollection(null, null)
                        .Where(i => i.Id == 1 || i.Title == "title");

            var actual = query.ToString();

            Assert.AreEqual(expected, actual, true);
        }
Exemplo n.º 6
0
        public void TestLessEqual()
        {
            var expected = "$filter=Number le 0";

            var query = new ListItemCollection(null, null)
                        .Where(i => (int)i.Values["Number"] <= 0);

            var actual = query.ToString();

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 7
0
        public void TestNotEqual()
        {
            var expected = "$filter=Title ne 'title'";

            var query = new ListItemCollection(null, null)
                        .Where(i => i.Title != "title");

            var actual = query.ToString();

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 8
0
        public void TestQuadrupleOr()
        {
            var expected = "$filter=(((id eq 1 or Title eq 'title') or Number eq 0) or Number2 eq 1)";

            var query = new ListItemCollection(null, null)
                        .Where(i => i.Id == 1 || i.Title == "title" || (int)i.Values["Number"] == 0 || (int)i.Values["Number2"] == 1);

            var actual = query.ToString();

            Assert.AreEqual(expected, actual, true);
        }