예제 #1
0
        public void InvalidDateTimeFilterTests(string submitValue, string filterFieldValue, string operatorType)
        {
            var expectedValue = new SubmissionMetaDataModel()
            {
                DisplayName = nameof(String),
                Name        = nameof(String),
                Type        = nameof(String),
                Value       = submitValue
            };

            var filterValue = new SearchTermModel()
            {
                FieldName        = FilterConstants.FilterFieldTypes.StringType,
                FieldType        = FilterConstants.FilterFieldTypes.DateType,
                FieldValue       = filterFieldValue,
                OperatorProperty = operatorType
            };

            Assert.Throws <ValidationException>(() => DateTimeFilter.MatchesFilter(expectedValue, filterValue));
        }
예제 #2
0
        public void ValidDateTimeFilterTests(string submitValue, string filterFieldValue, string operatorType, bool expectedResult)
        {
            var expectedValue = new SubmissionMetaDataModel()
            {
                DisplayName = nameof(String),
                Name        = nameof(String),
                Type        = nameof(String),
                Value       = submitValue
            };

            var filterValue = new SearchTermModel()
            {
                FieldName        = FilterConstants.FilterFieldTypes.StringType,
                FieldType        = FilterConstants.FilterFieldTypes.DateType,
                FieldValue       = filterFieldValue,
                OperatorProperty = operatorType
            };

            var result = DateTimeFilter.MatchesFilter(expectedValue, filterValue);

            Assert.Equal(expectedResult, result);
        }