示例#1
0
        public void Match_Boolean_everything_else(OperatorTypeEnum operatorType)
        {
            var sut = new Criterion
            {
                Operator = new Operator
                {
                    DataType     = DataTypeEnum.Boolean,
                    OperatorType = operatorType
                },
                PropertyValue = true.ToString()
            };

            var actual = sut.Match(true);

            Assert.False(actual);
        }
示例#2
0
        public void Match_String_operators(OperatorTypeEnum operatorType, string left, string right, bool expected)
        {
            var sut = new Criterion
            {
                Operator = new Operator
                {
                    DataType     = DataTypeEnum.String,
                    OperatorType = operatorType
                },
                PropertyValue = right
            };

            var actual = sut.Match(left);

            Assert.Equal(expected, actual);
        }
示例#3
0
        public void Match_Long_operators(OperatorTypeEnum operatorType, long left, long right, bool expected)
        {
            var sut = new Criterion
            {
                Operator = new Operator
                {
                    DataType     = DataTypeEnum.Long,
                    OperatorType = operatorType
                },
                PropertyValue = right.ToString(CultureInfo.InvariantCulture)
            };

            var actual = sut.Match(left);

            Assert.Equal(expected, actual);
        }
示例#4
0
        public void Match_DateTime_everything_else(OperatorTypeEnum operatorType)
        {
            var value = DateTime.UtcNow;
            var sut   = new Criterion
            {
                Operator = new Operator
                {
                    DataType     = DataTypeEnum.DateTime,
                    OperatorType = operatorType
                },
                PropertyValue = value.ToString(CultureInfo.InvariantCulture)
            };

            var actual = sut.Match(value);

            Assert.False(actual);
        }
示例#5
0
        public void Match_DateTime_operators(OperatorTypeEnum operatorType, int year, int month, int day, int d, bool expected)
        {
            var value = new DateTime(year, month, day, 0, 0, 0, DateTimeKind.Utc);
            var sut   = new Criterion
            {
                Operator = new Operator
                {
                    DataType     = DataTypeEnum.DateTime,
                    OperatorType = operatorType
                },
                PropertyValue = value.AddDays(d).ToString(CultureInfo.InvariantCulture)
            };

            var actual = sut.Match(value);

            Assert.Equal(expected, actual);
        }
示例#6
0
        public void Match_Boolean_equals(bool lhs, bool rhs)
        {
            var expected = lhs == rhs;
            var sut      = new Criterion
            {
                Operator = new Operator
                {
                    DataType     = DataTypeEnum.Boolean,
                    OperatorType = OperatorTypeEnum.Equals
                },
                PropertyValue = rhs.ToString(),
            };

            var actual = sut.Match(lhs);

            Assert.Equal(expected, actual);
        }
示例#7
0
        public void Match_with_inverted_operator()
        {
            var value = "blaroiew";
            var sut   = new Criterion
            {
                Operator = new Operator
                {
                    DataType     = DataTypeEnum.String,
                    IsInverted   = true,
                    OperatorType = OperatorTypeEnum.Equals
                },
                PropertyValue = value.ToString(CultureInfo.InvariantCulture)
            };

            var actual = sut.Match(value);

            Assert.False(actual);
        }