示例#1
0
        public void ODataQueryBuilderList_Filter_With_ReplaceCharacters_KeyValuePairs_ArgumentException()
        {
            var constValue = "3 & 4 / 7 ? 8 % 9 # 1";

            _odataQueryBuilderDefault
            .Invoking((r) => r
                      .For <ODataTypeEntity>(s => s.ODataType)
                      .ByList()
                      .Filter((s, f) => s.ODataKind.ODataCode.Code == f.ReplaceCharacters(
                                  constValue,
                                  null))
                      .ToUri())
            .Should().Throw <ArgumentException>().WithMessage("KeyValuePairs is null");
        }
        public void ODataQueryBuilderList_Function_Datetime_convert_exception()
        {
            var currentDateToday = new DateTime?(new DateTime(2019, 2, 9));

            _odataQueryBuilderDefault.Invoking((q) => q
                                               .For <ODataTypeEntity>(s => s.ODataType)
                                               .ByList()
                                               .Filter((s, f) =>
                                                       f.Date(s.ODataKind.OpenDate) == f.ConvertDateTimeToString(currentDateToday.Value, "3"))
                                               .ToUri())
            .Should().Throw <FormatException>();
        }
示例#3
0
        public void ODataQueryBuilderList_Operator_In_is_empty_1()
        {
            var constEmptyIntIds = new int[0];

            var odataQueryBuilderOptions = new ODataQueryBuilderOptions {
                SuppressExceptionOfNullOrEmptyOperatorArgs = false
            };
            var odataQueryBuilder = new ODataQueryBuilder <ODataInfoContainer>(
                _commonFixture.BaseUri, odataQueryBuilderOptions);

            odataQueryBuilder.Invoking(
                (r) => r
                .For <ODataTypeEntity>(s => s.ODataType)
                .ByList()
                .Filter((s, f, o) => o.In(s.IdType, constEmptyIntIds))
                .ToUri())
            .Should().Throw <ArgumentException>().WithMessage("Enumeration is empty or null");
        }
示例#4
0
        public void ODataQueryBuilderList_Operator_In_is_null_4()
        {
            var constIntIds            = default(int[]);
            var newObjectSequenceArray = new ODataTypeEntity {
                ODataKind = new ODataKindEntity {
                    SequenceArray = constIntIds
                }
            };

            var odataQueryBuilderOptions = new ODataQueryBuilderOptions {
                SuppressExceptionOfNullOrEmptyOperatorArgs = false
            };
            var odataQueryBuilder = new ODataQueryBuilder <ODataInfoContainer>(
                _commonFixture.BaseUri, odataQueryBuilderOptions);

            odataQueryBuilder.Invoking(
                (r) => r
                .For <ODataTypeEntity>(s => s.ODataType)
                .ByList()
                .Filter((s, f, o) => o.In(s.ODataKind.ODataCode.IdCode, newObjectSequenceArray.ODataKind.SequenceArray))
                .ToUri())
            .Should().Throw <ArgumentException>().WithMessage("Enumeration is empty or null");
        }