Пример #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);
        }
Пример #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);
        }