public static AndConstraint <StarToken> ShouldBeStarToken(this QueryToken token) { token.Should().BeOfType <StarToken>(); var starToken = token.As <StarToken>(); starToken.Kind.Should().Be(QueryTokenKind.Star); return(new AndConstraint <StarToken>(starToken)); }
public static AndConstraint <StringLiteralToken> ShouldBeStringLiteralToken(this QueryToken token, string text) { token.Should().BeOfType <StringLiteralToken>(); StringLiteralToken stringLiteralToken = token.As <StringLiteralToken>(); stringLiteralToken.Text.Should().Be(text); return(new AndConstraint <StringLiteralToken>(stringLiteralToken)); }
public static AndConstraint <InnerPathToken> ShouldBeInnerPathToken(this QueryToken token, string expectedName) { token.Should().BeOfType <InnerPathToken>(); var nonRootToken = token.As <InnerPathToken>(); nonRootToken.Kind.Should().Be(QueryTokenKind.InnerPath); nonRootToken.Identifier.Should().Be(expectedName); return(new AndConstraint <InnerPathToken>(nonRootToken)); }
public static AndConstraint <UnaryOperatorToken> ShouldBeUnaryOperatorQueryToken(this QueryToken token, UnaryOperatorKind expectedOperatorKind) { token.Should().BeOfType <UnaryOperatorToken>(); var propertyAccessQueryToken = token.As <UnaryOperatorToken>(); propertyAccessQueryToken.Kind.Should().Be(QueryTokenKind.UnaryOperator); propertyAccessQueryToken.OperatorKind.Should().Be(expectedOperatorKind); return(new AndConstraint <UnaryOperatorToken>(propertyAccessQueryToken)); }
public static AndConstraint <RangeVariableToken> ShouldBeRangeVariableToken(this QueryToken token, string expectedName) { token.Should().BeOfType <RangeVariableToken>(); var parameterQueryToken = token.As <RangeVariableToken>(); parameterQueryToken.Kind.Should().Be(QueryTokenKind.RangeVariable); parameterQueryToken.Name.Should().Be(expectedName); return(new AndConstraint <RangeVariableToken>(parameterQueryToken)); }
public static AndConstraint <EndPathToken> ShouldBeEndPathToken(this QueryToken token, string expectedName) { token.Should().BeOfType <EndPathToken>(); var propertyAccessQueryToken = token.As <EndPathToken>(); propertyAccessQueryToken.Kind.Should().Be(QueryTokenKind.EndPath); propertyAccessQueryToken.Identifier.Should().Be(expectedName); return(new AndConstraint <EndPathToken>(propertyAccessQueryToken)); }
public static AndConstraint <FunctionCallToken> ShouldBeFunctionCallToken(this QueryToken token, string name) { token.Should().BeOfType <FunctionCallToken>(); var functionCallQueryToken = token.As <FunctionCallToken>(); functionCallQueryToken.Kind.Should().Be(QueryTokenKind.FunctionCall); functionCallQueryToken.Name.Should().Be(name); return(new AndConstraint <FunctionCallToken>(functionCallQueryToken)); }
public static AndConstraint <AllToken> ShouldBeAllToken(this QueryToken token, string expectedParameterName) { token.Should().BeOfType <AllToken>(); var allToken = token.As <AllToken>(); allToken.Kind.Should().Be(QueryTokenKind.Any); allToken.Parameter.Should().Be(expectedParameterName); return(new AndConstraint <AllToken>(allToken)); }
public static AndConstraint <DottedIdentifierToken> ShouldBeDottedIdentifierToken(this QueryToken token, string typeName) { token.Should().BeOfType <DottedIdentifierToken>(); var dottedIdentifierToken = token.As <DottedIdentifierToken>(); dottedIdentifierToken.Kind.Should().Be(QueryTokenKind.DottedIdentifier); dottedIdentifierToken.Identifier.Should().Be(typeName); return(new AndConstraint <DottedIdentifierToken>(dottedIdentifierToken)); }
public static AndConstraint <LiteralToken> ShouldBeLiteralQueryToken(this QueryToken token, object expectedValue) { token.Should().BeOfType <LiteralToken>(); var literalToken = token.As <LiteralToken>(); literalToken.Kind.Should().Be(QueryTokenKind.Literal); literalToken.Value.Should().Be(expectedValue); return(new AndConstraint <LiteralToken>(literalToken)); }
public static AndConstraint <ExpandTermToken> ShouldBeExpandTermToken(this QueryToken token, string propertyName, bool checkNullParent) { token.Should().BeOfType <ExpandTermToken>(); ExpandTermToken expandTermToken = token.As <ExpandTermToken>(); expandTermToken.Kind.Should().Be(QueryTokenKind.ExpandTerm); expandTermToken.PathToNavProp.Identifier.Should().Be(propertyName); if (checkNullParent) { expandTermToken.PathToNavProp.NextToken.Should().BeNull(); } return(new AndConstraint <ExpandTermToken>(expandTermToken)); }
/// <summary> /// We substitute this method for the MetadataBinder.Bind method to keep the tests from growing too large in scope. /// In practice this does the same thing. /// </summary> internal SingleValueNode BindMethod(QueryToken queryToken) { queryToken.Should().BeOfType<RangeVariableToken>(); return RangeVariableBinder.BindRangeVariableToken(queryToken.As<RangeVariableToken>(), this.bindingState) as SingleValueNode; }
/// <summary> /// We substitute this method for the MetadataBinder.Bind method to keep the tests from growing too large in scope. /// In practice this does the same thing. /// </summary> internal SingleValueNode BindMethod(QueryToken queryToken) { queryToken.Should().BeOfType <RangeVariableToken>(); return(RangeVariableBinder.BindRangeVariableToken(queryToken.As <RangeVariableToken>(), this.bindingState) as SingleValueNode); }