public void RangeVariableNameUsedOutsideOfScopeShouldFailIfTypeIsNotOpen() { // Repro for: Syntactic parser assumes any token which matches the name of a previously used range variable is also a range variable, even after the scope has been exited Action parse = () => HardCodedTestModel.ParseUri("Dogs?$filter=MyPeople/all(a: true) and a ne null", this.edmModel); parse.ShouldThrow <ODataException>().WithMessage(ODataErrorStrings.MetadataBinder_PropertyNotDeclared("Fully.Qualified.Namespace.Dog", "a")); }
public void NonexistentPropertyThrowsUsefulError() { ExpandToken expandToken = new ExpandToken(new[] { new ExpandTermToken(new NonSystemToken("Blah", null, null)) }); Action bind = () => this.binderForPerson.Bind(BuildUnifiedSelectExpandToken(expandToken)); bind.ShouldThrow <ODataException>() .WithMessage(ODataErrorStrings.MetadataBinder_PropertyNotDeclared(HardCodedTestModel.GetPersonType().FullName(), "Blah")); }
public void ParseFilterWithClosedTypeAndOpenPropertyExpectException() { var personType = HardCodedTestModel.GetPersonType(); Action parse = () => ParseFilter("PhantomProperty ne 'Bug'", HardCodedTestModel.TestModel, personType); var expectedMessage = ODataErrorStrings.MetadataBinder_PropertyNotDeclared( personType.ODataFullName(), "PhantomProperty"); parse.ShouldThrow <ODataException>().WithMessage(expectedMessage); }
public void MissingPropertyShouldThrow() { const string MissingPropertyName = "ThisPropertyDoesNotExist"; var state = new BindingState(configuration); var binder = new InnerPathTokenBinder(FakeBindMethods.BindMethodReturningASingleDog, state); var token = new InnerPathToken(MissingPropertyName, new DummyToken(), null /*namedValues*/); Action bind = () => binder.BindInnerPathSegment(token); string expectedMessage = ODataErrorStrings.MetadataBinder_PropertyNotDeclared(HardCodedTestModel.GetDogType().ODataFullName(), MissingPropertyName); bind.ShouldThrow <ODataException>(expectedMessage); }
public void OperationWithParenthesesShouldNotWork() { Action action = () => SelectPathSegmentTokenBinder.ConvertNonTypeTokenToSegment(new NonSystemToken("Move()", null, null), HardCodedTestModel.TestModel, HardCodedTestModel.GetPersonType()).Should(); action.ShouldThrow <ODataException>().WithMessage(ODataErrorStrings.MetadataBinder_PropertyNotDeclared("Fully.Qualified.Namespace.Person", "Move()")); }