public void ValidatePathIsSupported_ThrowsForUnsupportedPathForExpand() { ODataPath path = new ODataPath(new ValueSegment(previousType: null)); ExceptionAssert.Throws <ODataException>( () => SelectExpandNode.ValidatePathIsSupportedForExpand(path), "A path within the select or expand query option is not supported."); }
private static Dictionary <IEdmNavigationProperty, ExpandedReferenceSelectItem> GetPropertiesToExpandInQuery(SelectExpandClause selectExpandClause) { Dictionary <IEdmNavigationProperty, ExpandedReferenceSelectItem> properties = new Dictionary <IEdmNavigationProperty, ExpandedReferenceSelectItem>(); foreach (SelectItem selectItem in selectExpandClause.SelectedItems) { ExpandedReferenceSelectItem expandItem = selectItem as ExpandedReferenceSelectItem; if (expandItem != null) { SelectExpandNode.ValidatePathIsSupportedForExpand(expandItem.PathToNavigationProperty); NavigationPropertySegment navigationSegment = expandItem.PathToNavigationProperty.LastSegment as NavigationPropertySegment; if (navigationSegment == null) { throw new ODataException(SRResources.UnsupportedSelectExpandPath); } properties[navigationSegment.NavigationProperty] = expandItem; } } return(properties); }