示例#1
0
        public void Property_LtEq()
        {
            var selector = new SelectorSyntaxParser().Parse("[Name <= 123]");

            selector.Should().BeOfType <ComplexSelectorList>();
            selector.ToSelectorString().Should().Be(new ComplexSelectorList(new ComplexSelector(new PropertyLessThanEqualMatchSelector("Name", 123))).ToSelectorString());
        }
示例#2
0
        public void TypeSelector_SyntaxKind()
        {
            var selector = new SelectorSyntaxParser().Parse("ClassDeclaration");

            selector.Should().BeOfType <ComplexSelectorList>();
            selector.ToSelectorString().Should().Be(new ComplexSelectorList(new ComplexSelector(new TypeSelector(SyntaxKind.ClassDeclaration))).ToSelectorString());
        }
示例#3
0
        public void UniversalTypeSelector()
        {
            var selector = new SelectorSyntaxParser().Parse("*");

            selector.Should().BeOfType <ComplexSelectorList>();
            selector.ToSelectorString().Should().Be(new ComplexSelectorList(new ComplexSelector(new UniversalTypeSelector())).ToSelectorString());
        }
示例#4
0
        public void PseudoClass_Interface()
        {
            var selector = new SelectorSyntaxParser().Parse(":interface");

            selector.Should().BeOfType <ComplexSelectorList>();
            selector.ToSelectorString().Should().Be(new ComplexSelectorList(new ComplexSelector(new InterfacePseudoClassSelector())).ToSelectorString());
        }
示例#5
0
        public void PseudoClass_Lambda()
        {
            var selector = new SelectorSyntaxParser().Parse(":lambda");

            selector.Should().BeOfType <ComplexSelectorList>();
            selector.ToSelectorString().Should().Be(new ComplexSelectorList(new ComplexSelector(new LambdaPseudoClassSelector())).ToSelectorString());
        }
示例#6
0
        public void PseudoClass_Method()
        {
            var selector = new SelectorSyntaxParser().Parse(":method");

            selector.Should().BeOfType <ComplexSelectorList>();
            selector.ToSelectorString().Should().Be(new ComplexSelectorList(new ComplexSelector(new MethodPseudoClassSelector())).ToSelectorString());
        }
示例#7
0
        public void Property_ItemContainsMatchSelector()
        {
            var selector = new SelectorSyntaxParser().Parse("[Name ~= 'A']");

            selector.Should().BeOfType <ComplexSelectorList>();
            selector.ToSelectorString().Should().Be(new ComplexSelectorList(new ComplexSelector(new PropertyItemContainsMatchSelector("Name", "A"))).ToSelectorString());
        }
示例#8
0
        public void Property_Exact()
        {
            var selector = new SelectorSyntaxParser().Parse("[Name=A]");

            selector.Should().BeOfType <ComplexSelectorList>();
            selector.ToSelectorString().Should().Be(new ComplexSelectorList(new ComplexSelector(new PropertyExactMatchSelector("Name", "A"))).ToSelectorString());
        }
示例#9
0
        public void Property_NameOnly()
        {
            var selector = new SelectorSyntaxParser().Parse("[Name]");

            selector.Should().BeOfType <ComplexSelectorList>();
            selector.ToSelectorString().Should().Be(new ComplexSelectorList(new ComplexSelector(new PropertyNameSelector("Name"))).ToSelectorString());
        }
示例#10
0
        public void Property_Gt()
        {
            var selector = new SelectorSyntaxParser().Parse("[Name > 123]");

            selector.Should().BeOfType <ComplexSelectorList>();
            selector.ToSelectorString().Should().Be(new ComplexSelectorList(new ComplexSelector(new PropertyGreaterThanMatchSelector("Name", 123))).ToSelectorString());
        }
示例#11
0
        public void SubsequentSiblingCombinator()
        {
            var selector = new SelectorSyntaxParser().Parse("ClassDeclaration ~ MethodDeclaration");

            selector.Should().BeOfType <ComplexSelectorList>();
            selector.ToSelectorString().Should().Be(
                new ComplexSelectorList(
                    new ComplexSelector(new TypeSelector(SyntaxKind.ClassDeclaration), new SubsequentSiblingCombinator(), new TypeSelector(SyntaxKind.MethodDeclaration))
                    ).ToSelectorString());
        }
示例#12
0
        public void ChildCombinatorOneCapture()
        {
            var selector = new SelectorSyntaxParser().Parse("ClassDeclaration > $MethodDeclaration");

            selector.Should().BeOfType <ComplexSelectorList>();
            selector.ToSelectorString().Should().Be(
                new ComplexSelectorList(
                    new ComplexSelector(new TypeSelector(SyntaxKind.ClassDeclaration), new ChildCombinator(), new CaptureSelector(new TypeSelector(SyntaxKind.MethodDeclaration)))
                    ).ToSelectorString());
        }