Esempio n. 1
0
        public void ODataQueryBuilderList_concat_is_null_or_empty_value_agr2_success(string value)
        {
            var odataQueryBuilderOptions = new ODataQueryBuilderOptions {
                SuppressExceptionOfNullOrEmptyFunctionArgs = true
            };
            var odataQueryBuilder = new ODataQueryBuilder <ODataInfoContainer>(
                _commonFixture.BaseUri, odataQueryBuilderOptions);

            var uri = odataQueryBuilder
                      .For <ODataTypeEntity>(s => s.ODataType)
                      .ByList()
                      .Filter((s, f) => f.Concat(s.TypeCode, value) == "typeCodeTest;")
                      .ToUri();

            uri.OriginalString.Should().Be("http://mock/odata/ODataType?$filter='typeCodeTest;'");
        }
Esempio n. 2
0
        public void ODataQueryBuilderList_Operator_In_Empty_Success()
        {
            var odataQueryBuilderOptions = new ODataQueryBuilderOptions {
                SuppressExceptionOfNullOrEmptyOperatorArgs = true
            };
            var odataQueryBuilder = new ODataQueryBuilder <ODataInfoContainer>(
                _commonFixture.BaseUri, odataQueryBuilderOptions);

            var constStrIds = default(IEnumerable <string>);
            var constEmprtyStrListIds = new string[] { }.ToList();
            var constIntIds = default(int[]);
            var constEmptyIntIds = new int[0];
            var constIntListIds = new[] { 123, 512 }.ToList();
            var newObject = new ODataTypeEntity {
                ODataKind = new ODataKindEntity {
                    Sequence = constIntListIds
                }
            };
            var newObjectSequenceArray = new ODataTypeEntity {
                ODataKind = new ODataKindEntity {
                    SequenceArray = constIntIds
                }
            };

            var uri = odataQueryBuilder
                      .For <ODataTypeEntity>(s => s.ODataType)
                      .ByList()
                      .Filter((s, f, o) => o.In(s.ODataKind.ODataCode.Code, constStrIds) &&
                              o.In(s.ODataKind.ODataCode.Code, constEmprtyStrListIds) &&
                              o.In(s.IdType, constIntIds) &&
                              o.In(s.IdType, constEmptyIntIds) &&
                              o.In(s.IdType, constIntListIds) &&
                              o.In((int)s.IdRule, constIntIds) &&
                              o.In((int)s.IdRule, constIntListIds) &&
                              o.In(s.ODataKind.IdKind, newObject.ODataKind.Sequence) &&
                              o.In(s.ODataKind.ODataCode.IdCode, newObjectSequenceArray.ODataKind.SequenceArray))
                      .ToUri();

            uri.OriginalString.Should().Be("http://mock/odata/ODataType?$filter=IdType in (123,512) and IdRule in (123,512) and ODataKind/IdKind in (123,512)");
        }
Esempio n. 3
0
        public void ODataQueryBuilderList_Test_Contains_is_null_or_empty_value_Success()
        {
            var odataQueryBuilderOptions = new ODataQueryBuilderOptions {
                SuppressExceptionOfNullOrEmptyFunctionArgs = true
            };
            var odataQueryBuilder = new ODataQueryBuilder <ODataInfoContainer>(
                _commonFixture.BaseUri, odataQueryBuilderOptions);

            var constValue = "P";
            var newObject  = new ODataTypeEntity {
                TypeCode = string.Empty
            };
            var uri = odataQueryBuilder
                      .For <ODataTypeEntity>(s => s.ODataType)
                      .ByList()
                      .Filter((s, f) =>
                              f.Contains(f.ToLower(s.ODataKind.ODataCode.Code), null) ||
                              f.Contains(s.ODataKind.ODataCode.Code, constValue) ||
                              f.Contains(s.ODataKindNew.ODataCode.Code, newObject.TypeCode) ||
                              f.Contains(s.ODataKindNew.ODataCode.Code, string.Empty))
                      .ToUri();

            uri.OriginalString.Should().Be("http://mock/odata/ODataType?$filter=contains(ODataKind/ODataCode/Code,'P')");
        }
Esempio n. 4
0
        public void ODataQueryBuilderList_Expand_Simple_Success()
        {
            var uri = _odataQueryBuilderDefault
                      .For <ODataTypeEntity>(s => s.ODataType)
                      .ByList()
                      .Expand(s => new { s.ODataKind })
                      .ToUri();

            uri.OriginalString.Should().Be("http://mock/odata/ODataType?$expand=ODataKind");
        }