public void SingleExpandResultsInSingleExpandTree()
 {
     SelectExpandPathToStringVisitor visitor = new SelectExpandPathToStringVisitor();
     NonSystemToken path = new NonSystemToken("NavProp", null, null);
     path.IsStructuralProperty = false;
     path.Accept(visitor).Should().Be("NavProp");
 }
示例#2
0
 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)");
 }
示例#7
0
 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("*");
 }
示例#8
0
 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 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();
        }
示例#11
0
        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 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();
 }
示例#14
0
        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();
        }
示例#15
0
        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");
        }
示例#16
0
        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 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 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 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);
        }
示例#20
0
        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);
        }
示例#21
0
        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);
        }
示例#22
0
        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 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);
        }
示例#24
0
 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");
 }
示例#25
0
        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");
        }