public void CanTranslate_ParameterAliasNode() { // Arrange var translator = new ParameterAliasNodeTranslator( new Dictionary<string, SingleValueNode> { { "@p", _parameterAliasMappedNode } }); var parameterAliasNode = new ParameterAliasNode("@p", null); // Act QueryNode translatedNode = parameterAliasNode.Accept(translator); // Assert Assert.Same(_parameterAliasMappedNode, translatedNode); }
public void ReturnsNull_ParameterAliasNotFound() { // Arrange var translator = new ParameterAliasNodeTranslator(new Dictionary<string, SingleValueNode>()); var parameterAliasNode = new ParameterAliasNode("@unknown", null); // Act QueryNode translatedNode = parameterAliasNode.Accept(translator); // Assert var constantNode = Assert.IsType<ConstantNode>(translatedNode); Assert.Null(constantNode.Value); }
public void ReturnsNull_ParameterAliasNotFound() { // Arrange var translator = new ParameterAliasNodeTranslator(new Dictionary <string, SingleValueNode>()); var parameterAliasNode = new ParameterAliasNode("@unknown", null); // Act QueryNode translatedNode = parameterAliasNode.Accept(translator); // Assert var constantNode = Assert.IsType <ConstantNode>(translatedNode); Assert.Null(constantNode.Value); }
public void CanTranslate_ParameterAliasNode() { // Arrange var translator = new ParameterAliasNodeTranslator( new Dictionary <string, SingleValueNode> { { "@p", _parameterAliasMappedNode } }); var parameterAliasNode = new ParameterAliasNode("@p", null); // Act QueryNode translatedNode = parameterAliasNode.Accept(translator); // Assert Assert.Same(_parameterAliasMappedNode, translatedNode); }
private QueryNode TranslateFilterExpression(string filter) { var parser = new ODataQueryOptionParser(_model, _customerEntityType, _customersEntitySet, new Dictionary <string, string> { { "$filter", filter } }); FilterClause filterClause = parser.ParseFilter(); var translator = new ParameterAliasNodeTranslator( new Dictionary <string, SingleValueNode> { { "@p", _parameterAliasMappedNode } }); QueryNode translatedNode = filterClause.Expression.Accept(translator); return(translatedNode); }
private QueryNode TranslateFilterExpression(string filter) { var parser = new ODataQueryOptionParser(_model, _customerEntityType, _customersEntitySet, new Dictionary<string, string> { { "$filter", filter } }); FilterClause filterClause = parser.ParseFilter(); var translator = new ParameterAliasNodeTranslator( new Dictionary<string, SingleValueNode> { { "@p", _parameterAliasMappedNode } }); QueryNode translatedNode = filterClause.Expression.Accept(translator); return translatedNode; }