示例#1
0
        public void ShouldGetReverseFilterTypeWhenGivenSingleItemAndInvokeNot()
        {
            var filter = FilterInfo.CreateItem("Age", Operator.GreaterThan, 1).Not();

            filter.OpType.Should().Be(CombinSymbol.SingleItem);
            filter.Operator.Should().Be(Operator.LessThanOrEqual);
            filter.Left.Should().BeEquivalentTo(ValueInfo.Parse("Age"));
            filter.Right.Should().BeEquivalentTo(ValueInfo.FromConstantValue(1));
        }
示例#2
0
        public void ShouldGetReverseFilterTypeWhenGivenOrOpTypeAndInvokeNot()
        {
            var filter = FilterInfo.CreateItem("Age", Operator.GreaterThan, 1)
                         .OrElse("Name", Operator.StartsWith, "Zhang").Not();

            filter.OpType.Should().Be(CombinSymbol.AndItems);
            filter.Items.Count.Should().Be(2);
            filter.Items.First().Left.Should().BeEquivalentTo(ValueInfo.Parse("Age"));
            filter.Items.First().Operator.Should().Be(Operator.LessThanOrEqual);
            filter.Items.First().Right.Should().BeEquivalentTo(ValueInfo.FromConstantValue(1));

            filter.Items.Last().Left.Should().BeEquivalentTo(ValueInfo.Parse("Name"));
            filter.Items.Last().Operator.Should().Be(Operator.NotStartsWith);
            filter.Items.Last().Right.Should().BeEquivalentTo(ValueInfo.FromConstantValue("Zhang"));
        }