コード例 #1
0
        public void OperatorPropertyNull_MatchesBoolFilterTest()
        {
            var expectedValue = new SubmissionMetaDataModel()
            {
                DisplayName = nameof(String),
                Name        = nameof(String),
                Type        = nameof(String),
                Value       = nameof(String),
            };

            var filterValue = new SearchTermModel()
            {
                FieldName        = FilterConstants.FilterFieldTypes.StringType,
                FieldType        = FilterConstants.FilterFieldTypes.BooleanType,
                FieldValue       = FilterConstants.FilterFieldTypes.StringType,
                OperatorProperty = null
            };

            Assert.Throws <NotImplementedException>(() => BooleanFilter.MatchesFilter(expectedValue, filterValue));
        }
コード例 #2
0
        public void DoesNotMatchBoolFilterTest(string submitValue, string fieldValue, 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.BooleanType,
                FieldValue       = fieldValue,
                OperatorProperty = FilterConstants.CommonFieldOperators.NotEqual
            };

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

            Assert.Equal(expectedResult, result);
        }