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()); }
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()); }
public void UniversalTypeSelector() { var selector = new SelectorSyntaxParser().Parse("*"); selector.Should().BeOfType <ComplexSelectorList>(); selector.ToSelectorString().Should().Be(new ComplexSelectorList(new ComplexSelector(new UniversalTypeSelector())).ToSelectorString()); }
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()); }
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()); }
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()); }
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()); }
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()); }
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()); }
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()); }
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()); }
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()); }