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));
 }
示例#2
0
        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 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);
        }
示例#5
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 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 SystemTokensThrowNotSupportedError()
        {
            AddNewEndingTokenVisitor visitor = new AddNewEndingTokenVisitor(new NonSystemToken("stuff", null, null));
            SystemToken token            = new SystemToken(ExpressionConstants.It, null);
            Action      visitSystemToken = () => token.Accept(visitor);

            NotSupportedException exception = Assert.Throws <NotSupportedException>(visitSystemToken);

            Assert.Equal(Strings.ALinq_IllegalSystemQueryOption(ExpressionConstants.It), exception.Message);
        }
示例#8
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);
        }
示例#10
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);
            }
        }