示例#1
0
        private static SelectExpandClause CreateSelectExpandClauseNestedSelectWithComplexType()
        {
            ODataSelectPath personNamePath = new ODataSelectPath(new PropertySegment(HardCodedTestModel.GetPersonNameProp()));
            ODataSelectPath personShoePath = new ODataSelectPath(new PropertySegment(HardCodedTestModel.GetPersonFavoriteDateProp()));
            ODataSelectPath addrPath       = new ODataSelectPath(new PropertySegment(HardCodedTestModel.GetPersonAddressProp()));
            ODataSelectPath cityPath       = new ODataSelectPath(new PropertySegment(HardCodedTestModel.GetAddressCityProperty()));

            var cityClause = new SelectExpandClause(new List <SelectItem>(), false);

            cityClause.AddToSelectedItems(new PathSelectItem(cityPath));
            var addritem = new PathSelectItem(addrPath);

            addritem.SelectAndExpand = cityClause;

            var addritem1 = new PathSelectItem(addrPath);

            var clause = new SelectExpandClause(new List <SelectItem>(), false);

            clause.AddToSelectedItems(new PathSelectItem(personShoePath));
            clause.AddToSelectedItems(new PathSelectItem(personNamePath));
            clause.AddToSelectedItems(addritem);
            clause.AddToSelectedItems(addritem1);

            return(clause);
        }
        public void CanSelectPropertyOnNonEntityType()
        {
            ExpandTermToken expandTermToken = new ExpandTermToken(new SystemToken(ExpressionConstants.It, null), new SelectToken(new List <PathSegmentToken>()
            {
                new NonSystemToken("City", null, null)
            }), null);
            ExpandToken expandToken = new ExpandToken(new ExpandTermToken[] { expandTermToken });
            var         item        = this.binderForAddress.Bind(expandToken);

            item.SelectedItems.Single().ShouldBePathSelectionItem(new ODataPath(new PropertySegment(HardCodedTestModel.GetAddressCityProperty())));
        }
示例#3
0
        public void CanSelectPropertyOnNonEntityType()
        {
            // Arrange
            SelectToken select = new SelectToken(new SelectTermToken[]
            {
                new SelectTermToken(new NonSystemToken("City", null, null))
            });

            // Arrange
            SelectExpandClause item = BinderForAddress.Bind(null, select);

            // Assert
            item.SelectedItems.Single().ShouldBePathSelectionItem(new ODataPath(new PropertySegment(HardCodedTestModel.GetAddressCityProperty())));
        }