Esempio n. 1
0
        public void PathExtensionsToExpandPathWithNavigationPropertyReturnsExpandedPath()
        {
            var             property = mbh.BuildValidPrimitiveProperty();
            ODataSelectPath path     = new ODataSelectPath(
                new ODataPathSegment[]
            {
                new NavigationPropertySegment(
                    HardCodedTestModel.GetPersonMyDogNavProp(), HardCodedTestModel.GetDogsSet())
            }
                );

            Assert.Equal(1, path.ToExpandPath().Count);
            Assert.Equal("MyDog", path.ToExpandPath().FirstSegment.Identifier);
        }
Esempio n. 2
0
        public void PathExtensionsToExpandPathWithNonNavigationPropertyThrows()
        {
            var             property = mbh.BuildValidPrimitiveProperty();
            ODataSelectPath path     = new ODataSelectPath(
                new ODataPathSegment[]
            {
                new PropertySegment(HardCodedTestModel.GetPersonNameProp())
            }
                );

            Action expandPathAction = () => path.ToExpandPath();

            expandPathAction.Throws <ODataException>(ODataErrorStrings.ODataExpandPath_OnlyLastSegmentMustBeNavigationProperty);
        }