public void SingleExpandResultsInSingleExpandTree() { SelectExpandPathToStringVisitor visitor = new SelectExpandPathToStringVisitor(); NonSystemToken path = new NonSystemToken("NavProp", null, null); path.IsStructuralProperty = false; path.Accept(visitor).Should().Be("NavProp"); }
public void ReversePathWorksWithATypeToken() { // $expand=Fully.Qualified.Namespace/1 PathReverser pathReverser = new PathReverser(); PathSegmentToken nonReversedPath = new NonSystemToken("1", null, new NonSystemToken("Fully.Qualified.Namespace", null, null)); PathSegmentToken reversedPath = nonReversedPath.Accept(pathReverser); reversedPath.ShouldBeNonSystemToken("Fully.Qualified.Namespace").And.NextToken.ShouldBeNonSystemToken("1"); }
public void IfNewTokenIsNullInputIsInvariant() { AddNewEndingTokenVisitor visitor = new AddNewEndingTokenVisitor(null); NonSystemToken token = new NonSystemToken("stuff", null, null); token.Accept(visitor); token.Identifier.Should().Be("stuff"); token.NextToken.Should().BeNull(); }
public void ExpandOnlyPathResultsInExpandOnlyTree() { SelectExpandPathToStringVisitor visitor = new SelectExpandPathToStringVisitor(); NonSystemToken path = new NonSystemToken("NavProp", null, new NonSystemToken("NavProp1", null, null)); path.IsStructuralProperty = false; path.NextToken.IsStructuralProperty = false; path.Accept(visitor).Should().Be("NavProp($expand=NavProp1)"); }
public void PathWithoutWildcardIsInvariant() { RemoveWildcardVisitor visitor = new RemoveWildcardVisitor(); NonSystemToken token = new NonSystemToken("stuff", null, null); token.Accept(visitor); token.Identifier.Should().Be("stuff"); token.NextToken.Should().BeNull(); }
public void SelectAtTheEndOfPathResultsInSelectQueryOption() { SelectExpandPathToStringVisitor visitor = new SelectExpandPathToStringVisitor(); NonSystemToken path = new NonSystemToken("NavProp", null, new NonSystemToken("StructuralProp", null, null)); path.IsStructuralProperty = false; path.NextToken.IsStructuralProperty = true; path.Accept(visitor).Should().Be("NavProp($select=StructuralProp)"); }
public void ReversePathWorksWithStarToken() { // $expand=1/* PathReverser pathReverser = new PathReverser(); PathSegmentToken nonReversedPath = new NonSystemToken("*", null, new NonSystemToken("1", null, null)); PathSegmentToken reversedPath = nonReversedPath.Accept(pathReverser); reversedPath.ShouldBeNonSystemToken("1").And.NextToken.ShouldBeNonSystemToken("*"); }
public void ReversePathWorksWithSingleSegment() { // $expand=1 PathReverser pathReverser = new PathReverser(); PathSegmentToken nonReversedPath = new NonSystemToken("1", null, null); PathSegmentToken reversedPath = nonReversedPath.Accept(pathReverser); reversedPath.ShouldBeNonSystemToken("1").And.NextToken.Should().BeNull(); }
public void WildcardIsRemoved() { RemoveWildcardVisitor visitor = new RemoveWildcardVisitor(); NonSystemToken token = new NonSystemToken("stuff", null, new NonSystemToken("*", null, null)); token.Accept(visitor); token.Identifier.Should().Be("stuff"); token.NextToken.Should().BeNull(); }
public void IfNewTokenIsPresentItIsAddedToEndOfPath() { AddNewEndingTokenVisitor visitor = new AddNewEndingTokenVisitor(new NonSystemToken("moreStuff", null, null)); NonSystemToken token = new NonSystemToken("stuff", null, null); token.Accept(visitor); token.Identifier.Should().Be("stuff"); token.NextToken.Identifier.Should().Be("moreStuff"); token.NextToken.NextToken.Should().BeNull(); }
public void IfNewTokenIsNullInputIsInvariant() { AddNewEndingTokenVisitor visitor = new AddNewEndingTokenVisitor(null); NonSystemToken token = new NonSystemToken("stuff", null, null); token.Accept(visitor); Assert.Equal("stuff", token.Identifier); Assert.Null(token.NextToken); }
public void WildcardIsRemoved() { RemoveWildcardVisitor visitor = new RemoveWildcardVisitor(); NonSystemToken token = new NonSystemToken("stuff", null, new NonSystemToken("*", null, null)); token.Accept(visitor); Assert.Equal("stuff", token.Identifier); Assert.Null(token.NextToken); }
public void PathWithoutWildcardIsInvariant() { RemoveWildcardVisitor visitor = new RemoveWildcardVisitor(); NonSystemToken token = new NonSystemToken("stuff", null, null); token.Accept(visitor); Assert.Equal("stuff", token.Identifier); Assert.Null(token.NextToken); }
public void IfNewTokenIsPresentItIsAddedToEndOfPath() { AddNewEndingTokenVisitor visitor = new AddNewEndingTokenVisitor(new NonSystemToken("moreStuff", null, null)); NonSystemToken token = new NonSystemToken("stuff", null, null); token.Accept(visitor); Assert.Equal("stuff", token.Identifier); Assert.Equal("moreStuff", token.NextToken.Identifier); Assert.Null(token.NextToken.NextToken); }
public void ReversePathWorksWithDeepPath() { // $expand=1/2/3/4 PathReverser pathReverser = new PathReverser(); NonSystemToken endPath = new NonSystemToken("4", null, new NonSystemToken("3", null, new NonSystemToken("2", null, new NonSystemToken("1", null, null)))); PathSegmentToken reversedPath = endPath.Accept(pathReverser); reversedPath.ShouldBeNonSystemToken("1") .And.NextToken.ShouldBeNonSystemToken("2") .And.NextToken.ShouldBeNonSystemToken("3") .And.NextToken.ShouldBeNonSystemToken("4"); }
public void ReversePathWorksWithDeepPath() { // $expand=1/2/3/4 PathReverser pathReverser = new PathReverser(); NonSystemToken endPath = new NonSystemToken("4", null, new NonSystemToken("3", null, new NonSystemToken("2", null, new NonSystemToken("1", null, null)))); PathSegmentToken reversedPath = endPath.Accept(pathReverser); reversedPath.ShouldBeNonSystemToken("1") .NextToken.ShouldBeNonSystemToken("2") .NextToken.ShouldBeNonSystemToken("3") .NextToken.ShouldBeNonSystemToken("4"); }