Пример #1
0
        public void Int()
        {
            var odata    = ctx.Filter("intProperty eq 99");
            var expected = ctx.Where(x => x.intProperty == 99);

            AssertExpression.Equal(expected, odata);
        }
Пример #2
0
        public void trim()
        {
            var expected = ctx.Where(x => x.stringProperty.Trim() == "");
            var actual   = ctx.Filter("trim(stringProperty) eq ''");

            AssertExpression.Equal(expected, actual);
        }
Пример #3
0
        public void Bool()
        {
            var odata    = ctx.Filter("boolProperty eq True");
            var expected = ctx.Where(x => x.boolProperty == true);

            AssertExpression.Equal(expected, odata);
        }
Пример #4
0
        public void concat()
        {
            var actual   = ctx.Filter("concat(stringProperty, 'test') eq 'propTest'");
            var expected = ctx.Where(x => x.stringProperty + "test" == "propTest");

            AssertExpression.Equal(expected, actual);
        }
Пример #5
0
        public void ToUpperInvariant()
        {
            var expected = ctx.Where(x => x.stringProperty.ToUpperInvariant() == "");
            var actual   = ctx.Filter("toupper(stringProperty) eq ''");

            AssertExpression.Equal(expected, actual);
        }
Пример #6
0
        public void indexof()
        {
            var expected = ctx.Where(x => x.stringProperty.IndexOf("test") == 1);
            var actual   = ctx.Filter("indexof(stringProperty, 'test') eq 1");

            AssertExpression.Equal(expected, actual);
        }
Пример #7
0
        public void length()
        {
            var expected = ctx.Where(x => x.stringProperty.Length == 1);
            var actual   = ctx.Filter("length(stringProperty) eq 1");

            AssertExpression.Equal(expected, actual);
        }
Пример #8
0
        public void startswith()
        {
            var expected = ctx.Where(x => x.stringProperty.StartsWith("big"));
            var actual   = ctx.Filter("startswith(stringProperty, 'big')");

            AssertExpression.Equal(expected, actual);
        }
Пример #9
0
        public void contains()
        {
            var expected = ctx.Where(x => x.stringProperty.Contains("big"));
            var actual   = ctx.Filter("contains(stringProperty, 'big')");

            AssertExpression.Equal(expected, actual);
        }
Пример #10
0
        public void Guid_lower()
        {
            var odata    = ctx.Filter("guidProperty eq guid'61ca9677-caba-44a0-a187-7c86a8e0eac3'");
            var guid     = new System.Guid("61CA9677-CABA-44A0-A187-7C86A8E0EAC3");
            var expected = ctx.Where(x => x.guidProperty == guid);

            AssertExpression.Equal(expected, odata);
        }
Пример #11
0
        public void EnumText()
        {
            var odata = ctx.Filter(new Dictionary <string, string> {
                { "$filter", "enumProperty eq Linq2OData.Server.Tests.Models.TestObjectEnum'opt1'" }
            });

            var expected = ctx.Where(x => x.enumProperty == Models.TestObjectEnum.opt1);

            AssertExpression.Equal(expected.Expression, odata.Expression);
        }
Пример #12
0
        public void EnumValue()
        {
            var odata = ctx.Filter(new Dictionary <string, string> {
                { "$filter", "enumProperty eq 1" }
            });

            var expected = ctx.Where(x => x.enumProperty == Models.TestObjectEnum.opt1);

            AssertExpression.Equal(expected.Expression, odata.Expression);
        }
Пример #13
0
        public void String()
        {
            var odata = ctx.Filter(new Dictionary <string, string> {
                { "$filter", "stringProperty eq 'string'" }
            });

            var expected = ctx.Where(x => x.stringProperty == "string");

            AssertExpression.Equal(expected.Expression, odata.Expression);
        }