public void InvertPathsActuallyInvertsPaths()
 {
     // $expand=1/2
     ExpandToken expand = new ExpandToken(new ExpandTermToken[] { new ExpandTermToken(new NonSystemToken("2", null, new NonSystemToken("1", null, null))) });
     ExpandTreeNormalizer expandTreeNormalizer = new ExpandTreeNormalizer();
     ExpandToken invertedPaths = expandTreeNormalizer.NormalizePaths(expand);
     invertedPaths.ExpandTerms.Single().ShouldBeExpandTermToken("1", false)
         .And.PathToNavProp.NextToken.ShouldBeNonSystemToken("2");
 }
 public void InvertPathsKeepsExpandOptionsInvariant()
 {
     //$expand=1($filter=filter, $orderby=orderby, $top=top, $skip=skip;)
     ExpandToken expand = new ExpandToken(
                             new ExpandTermToken[] { 
                                 new ExpandTermToken(
                                     new NonSystemToken("1", null, null), 
                                     new LiteralToken("filter"), 
                                     new OrderByToken []{ new OrderByToken(new LiteralToken("orderby"), OrderByDirection.Descending)}, 
                                     1, 
                                     2, 
                                     false,
                                     3,
                                     new StringLiteralToken("searchme"), 
                                     new SelectToken(null), 
                                     new ExpandToken(null))
                             }
                         );
     ExpandTreeNormalizer expandTreeNormalizer = new ExpandTreeNormalizer();
     ExpandToken invertedPaths = expandTreeNormalizer.NormalizePaths(expand);
     var invertedToken = invertedPaths.ExpandTerms.Single();
     invertedToken.ShouldBeExpandTermToken("1", true);
     invertedToken.FilterOption.ShouldBeLiteralQueryToken("filter");
     invertedToken.OrderByOptions.Single().Expression.ShouldBeLiteralQueryToken("orderby");
     invertedToken.OrderByOptions.Single().Direction.Should().Be(OrderByDirection.Descending);
     invertedToken.TopOption.Should().Be(1);
     invertedToken.SkipOption.Should().Be(2);
     invertedToken.CountQueryOption.Should().BeFalse();
     invertedToken.LevelsOption.Should().Be(3);
     invertedToken.SearchOption.ShouldBeStringLiteralToken("searchme");
     invertedToken.SelectOption.Properties.Should().BeEmpty();
     invertedToken.ExpandOption.ExpandTerms.Should().BeEmpty();
 }