public void SystemTokensThrowNotSupportedError()
 {
     AddNewEndingTokenVisitor visitor = new AddNewEndingTokenVisitor(new NonSystemToken("stuff", null, null));
     SystemToken token = new SystemToken(ExpressionConstants.It, null);
     Action visitSystemToken = () => token.Accept(visitor);
     visitSystemToken.ShouldThrow<NotSupportedException>().WithMessage(Strings.ALinq_IllegalSystemQueryOption(ExpressionConstants.It));
 }
 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 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();
 }
Beispiel #4
0
        /// <summary>
        /// Appends a name of a property/link/type to the current expand path.
        /// </summary>
        /// <param name="name">name of the property/link/type which needs to be added to the expand path.</param>
        /// <param name="isStructural">is this a structural property.</param>
        private void AppendToExpandPath(string name, bool isStructural)
        {
            PathSegmentToken path     = this.expandPaths.LastOrDefault();
            NonSystemToken   newToken = new NonSystemToken(name, /*namedValues*/ null, /*nextToken*/ null);

            newToken.IsStructuralProperty = isStructural;
            if (path != null)
            {
                expandPaths.Remove(path);
                AddNewEndingTokenVisitor addNewEndingTokenVisitor = new AddNewEndingTokenVisitor(newToken);
                path.Accept(addNewEndingTokenVisitor);
                expandPaths.Add(path);
            }
            else
            {
                expandPaths.Add(newToken);
            }
        }
 /// <summary>
 /// Appends a name of a property/link/type to the current expand path.
 /// </summary>
 /// <param name="name">name of the property/link/type which needs to be added to the expand path.</param>
 /// <param name="isStructural">is this a structural property.</param>
 private void AppendToExpandPath(string name, bool isStructural)
 {
     PathSegmentToken path = this.expandPaths.LastOrDefault();
     NonSystemToken newToken = new NonSystemToken(name, /*namedValues*/null, /*nextToken*/null);
     newToken.IsStructuralProperty = isStructural;
     if (path != null)
     {
         expandPaths.Remove(path);
         AddNewEndingTokenVisitor addNewEndingTokenVisitor = new AddNewEndingTokenVisitor(newToken);
         path.Accept(addNewEndingTokenVisitor);
         expandPaths.Add(path);
     }
     else
     {
         expandPaths.Add(newToken);
     }
 }