public void SingleExpandResultsInSingleExpandTree()
 {
     SelectExpandPathToStringVisitor visitor = new SelectExpandPathToStringVisitor();
     NonSystemToken path = new NonSystemToken("NavProp", null, null);
     path.IsStructuralProperty = false;
     path.Accept(visitor).Should().Be("NavProp");
 }
Ejemplo n.º 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)");
 }
Ejemplo n.º 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("*");
 }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
 }
Ejemplo n.º 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();
        }
Ejemplo n.º 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");
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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");
 }
Ejemplo n.º 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");
        }