public void OpenPropertyIsNotBoundToAFunction() { var token = new EndPathToken("SomeOpenProperty", null); BindingState state = GetBindingStateForTest(HardCodedTestModel.GetPaintingTypeReference(), HardCodedTestModel.GetPaintingsSet()); EndPathBinder binder = new EndPathBinder(BindMethod, state); var result = binder.BindEndPath(token); result.ShouldBeSingleValueOpenPropertyAccessQueryNode("SomeOpenProperty"); }
public void Init() { this.bindingState = GetBindingStateForTest(HardCodedTestModel.GetPersonTypeReference(), HardCodedTestModel.GetPeopleSet()); this.propertyBinder = new EndPathBinder(BindMethod, this.bindingState); }
public void ShouldNotThrowIfTypeNotOpenButAggregateApplied() { var token = new EndPathToken("Color", new RangeVariableToken("a")); EntityCollectionNode entityCollectionNode = new EntitySetNode(HardCodedTestModel.GetDogsSet()); SingleValueNode parentNode = new EntityRangeVariableReferenceNode("a", new EntityRangeVariable("a", HardCodedTestModel.GetPersonTypeReference(), entityCollectionNode)); var state = new BindingState(this.configuration); state.AggregatedPropertyNames = new List<string> { "Color" }; var metadataBinder = new MetadataBinder(state); var endPathBinder = new EndPathBinder(metadataBinder.Bind, state); var propertyNode = endPathBinder.GeneratePropertyAccessQueryForOpenType( token, parentNode); propertyNode.ShouldBeSingleValueOpenPropertyAccessQueryNode("Color"); }
public void ShouldThrowIfTypeNotOpen() { var token = new EndPathToken("Color", new RangeVariableToken("a")); EntityCollectionNode entityCollectionNode = new EntitySetNode(HardCodedTestModel.GetDogsSet()); SingleValueNode parentNode = new EntityRangeVariableReferenceNode("a", new EntityRangeVariable("a", HardCodedTestModel.GetPersonTypeReference(), entityCollectionNode)); var state = new BindingState(this.configuration); var metadataBinder = new MetadataBinder(state); var endPathBinder = new EndPathBinder(metadataBinder.Bind, state); Action getQueryNode = () => endPathBinder.GeneratePropertyAccessQueryForOpenType( token, parentNode); getQueryNode.ShouldThrow<ODataException>().WithMessage( Strings.MetadataBinder_PropertyNotDeclared(parentNode.GetEdmTypeReference().FullName(), token.Identifier)); }
public void ShouldThrowNotImplementedIfTypeIsOpen() { const string OpenPropertyName = "Style"; var token = new EndPathToken(OpenPropertyName, new RangeVariableToken("a")); EntityCollectionNode entityCollectionNode = new EntitySetNode(HardCodedTestModel.GetPaintingsSet()); SingleValueNode parentNode = new EntityRangeVariableReferenceNode("a", new EntityRangeVariable("a", HardCodedTestModel.GetPaintingTypeReference(), entityCollectionNode)); var state = new BindingState(this.configuration); var metadataBinder = new MetadataBinder(state); var endPathBinder = new EndPathBinder(metadataBinder.Bind, state); var propertyNode = endPathBinder.GeneratePropertyAccessQueryForOpenType( token, parentNode); propertyNode.ShouldBeSingleValueOpenPropertyAccessQueryNode(OpenPropertyName); }
/// <summary> /// Binds a property access token. /// </summary> /// <param name="endPathToken">The property access token to bind.</param> /// <returns>The bound property access token.</returns> protected virtual QueryNode BindEndPath(EndPathToken endPathToken) { EndPathBinder endPathBinder = new EndPathBinder(this.Bind, this.BindingState); return(endPathBinder.BindEndPath(endPathToken)); }
/// <summary> /// Binds a property access token. /// </summary> /// <param name="endPathToken">The property access token to bind.</param> /// <returns>The bound property access token.</returns> protected virtual QueryNode BindEndPath(EndPathToken endPathToken) { EndPathBinder endPathBinder = new EndPathBinder(this.Bind, this.BindingState); return endPathBinder.BindEndPath(endPathToken); }