public void KeyOnCollectionEntityReferencesShouldWork()
        {
            var path = PathFunctionalTestsUtil.RunParsePath("Dogs(7)/MyPeople(2)/$ref");

            VerificationHelpers.VerifyPath(path, new Action <ODataPathSegment>[]
            {
                s => s.ShouldBeEntitySetSegment(HardCodedTestModel.GetDogsSet()),
                s => s.ShouldBeSimpleKeySegment(7),
                s => s.ShouldBeNavigationPropertyLinkSegment(HardCodedTestModel.GetDogMyPeopleNavProp()),
                s => s.ShouldBeSimpleKeySegment(2)
            });
        }
 public void EntityReferenceCannotAppearAfterProperty()
 {
     PathFunctionalTestsUtil.RunParseErrorPath <ODataUnrecognizedPathException>("People(1)/SSN/$ref", ODataErrorStrings.RequestUriProcessor_ValueSegmentAfterScalarPropertySegment("SSN", "$ref"));
 }
 public void KeyLookupCannotAppearAfterEntityReference()
 {
     PathFunctionalTestsUtil.RunParseErrorPath("Dogs(1)/$ref(1)", ODataErrorStrings.RequestUriProcessor_SyntaxError);
 }
 public void EntityReferenceCannotAppearAfterBatch()
 {
     // Note: Case where $ref is after batch reference is in PathFunctionaltests.cs (EntityReferenceCannotAppearAfterBatchReference)
     PathFunctionalTestsUtil.RunParseErrorPath <ODataUnrecognizedPathException>("$batch/$ref", ODataErrorStrings.RequestUriProcessor_MustBeLeafSegment(UriQueryConstants.BatchSegment));
 }
 public void EntityReferenceCannotAppearAfterMetadata()
 {
     PathFunctionalTestsUtil.RunParseErrorPath <ODataUnrecognizedPathException>("$metadata/$ref", ODataErrorStrings.RequestUriProcessor_MustBeLeafSegment("$metadata"));
 }
 public void CannotGoToPropetyOnEntityReference()
 {
     PathFunctionalTestsUtil.RunParseErrorPath <ODataUnrecognizedPathException>("People(7)/MyDog/$ref/Color", ODataErrorStrings.RequestUriProcessor_MustBeLeafSegment(UriQueryConstants.RefSegment));
 }
 public void EntityReferenceCannotAppearAfterAComplexProperty()
 {
     PathFunctionalTestsUtil.RunParseErrorPath("People(1)/MyAddress/$ref", ODataErrorStrings.PathParser_EntityReferenceNotSupported("MyAddress"));
 }
        public void EntityReferenceCanAppearAfterACollectionValuedNavigationProperty()
        {
            var path = PathFunctionalTestsUtil.RunParsePath("Dogs(1)/MyPeople/$ref");

            path.LastSegment.ShouldBeNavigationPropertyLinkSegment(HardCodedTestModel.GetDogMyPeopleNavProp());
        }
        public void EntityReferenceCanAppearAfterBoundFunctionReturningSingleEntity()
        {
            var path = PathFunctionalTestsUtil.RunParsePath("People/Fully.Qualified.Namespace.GetPersonWhoHasSmartestDog/$ref");

            path.LastSegment.ShouldBeReferenceSegment(HardCodedTestModel.GetPeopleSet());
        }
        public void EntityReferenceCanAppearAfterCastedType()
        {
            var path = PathFunctionalTestsUtil.RunParsePath("People/Fully.Qualified.Namespace.Employee/$ref");

            path.LastSegment.ShouldBeReferenceSegment(HardCodedTestModel.GetPeopleSet());
        }
 public void EntityReferenceCannotAppearAfterEachSegment()
 {
     PathFunctionalTestsUtil.RunParseErrorPath("People/$each/$ref", ODataErrorStrings.RequestUriProcessor_OnlySingleOperationCanFollowEachPathSegment);
 }
        public void EntityReferenceCanAppearAfterAComplexProperty()
        {
            var path = PathFunctionalTestsUtil.RunParsePath("People(1)/MyAddress/$ref");

            path.LastSegment.ShouldBeReferenceSegment(HardCodedTestModel.GetPeopleSet());
        }
 public void EntityReferenceCannotAppearAfterAValueSegment()
 {
     PathFunctionalTestsUtil.RunParseErrorPath <ODataUnrecognizedPathException>("People(1)/$value/$ref", ODataErrorStrings.RequestUriProcessor_MustBeLeafSegment("$value"));
 }
 public void KeyLookupCannotAppearAfterCountAfterEntityReference()
 {
     PathFunctionalTestsUtil.RunParseErrorPath("Dogs(1)/MyPeople/$ref/$count(1)", ODataErrorStrings.RequestUriProcessor_MustBeLeafSegment(UriQueryConstants.RefSegment));
 }
 public void EntityReferenceCannotAppearAfterReferenceSegment()
 {
     PathFunctionalTestsUtil.RunParseErrorPath("People/$ref/$ref", ODataErrorStrings.RequestUriProcessor_MustBeLeafSegment("$ref"));
 }
 public void CountCannotAppearAfterEntityReferenceCollectionProperties()
 {
     PathFunctionalTestsUtil.RunParseErrorPath <ODataUnrecognizedPathException>("Dogs(1)/MyPeople/$ref/$count", ODataErrorStrings.RequestUriProcessor_MustBeLeafSegment(UriQueryConstants.RefSegment));
 }
        public void EntityReferenceCanAppearAfterAnEntitySet()
        {
            var path = PathFunctionalTestsUtil.RunParsePath("People/$ref");

            path.LastSegment.ShouldBeReferenceSegment(HardCodedTestModel.GetPeopleSet());
        }
 public void EntityReferenceCannotAppearAfterBoundAction()
 {
     PathFunctionalTestsUtil.RunParseErrorPath("People/Fully.Qualified.Namespace.AdoptShibaInu/$ref", ODataErrorStrings.RequestUriProcessor_MustBeLeafSegment("Fully.Qualified.Namespace.AdoptShibaInu"));
 }
        public void EntityReferenceCanAppearAfterASingleValuedNavigationProperty()
        {
            var path = PathFunctionalTestsUtil.RunParsePath("Dogs(1)/FastestOwner/$ref");

            path.LastSegment.ShouldBeNavigationPropertyLinkSegment(HardCodedTestModel.GetDogFastestOwnerNavProp());
        }
 public void EntityReferenceCannotAppearAfterAnEntitySet()
 {
     // TODO: We can improve error message drastically when we refactor path parsing
     PathFunctionalTestsUtil.RunParseErrorPath("People/$ref", ODataErrorStrings.PathParser_EntityReferenceNotSupported("People"));
 }