Beispiel #1
0
        private static SelectExpandClause CreateSelectExpandClauseNestedSelectWithNestedAndComplex()
        {
            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()));
            ODataSelectPath neighboursPath = new ODataSelectPath(new PropertySegment(HardCodedTestModel.GetAddressMyNeighborsProperty()));

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

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

            addritem.SelectAndExpand = cityClause;


            var neighboursPathClause = new SelectExpandClause(new List <SelectItem>(), false);
            var neighboursPathItem   = new PathSelectItem(neighboursPath);

            neighboursPathItem.SelectAndExpand = cityClause;
            neighboursPathClause.AddToSelectedItems(neighboursPathItem);
            var addritem1 = new PathSelectItem(addrPath);

            addritem1.SelectAndExpand = neighboursPathClause;

            var neighboursPathClause2 = new SelectExpandClause(new List <SelectItem>(), false);
            var neighboursPathItem3   = new PathSelectItem(neighboursPath);

            neighboursPathClause2.AddToSelectedItems(neighboursPathItem3);
            var addritem2 = new PathSelectItem(addrPath);

            addritem2.SelectAndExpand = neighboursPathClause2;

            var addritem3 = 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);
            clause.AddToSelectedItems(addritem2);
            clause.AddToSelectedItems(addritem3);

            return(clause);
        }
Beispiel #2
0
        public void BindPropertyShouldReturnCorrectPropertyIfFoundForComplex()
        {
            var result = InnerPathTokenBinder.BindProperty(HardCodedTestModel.GetPersonAddressProp().Type, "MyNeighbors", DefaultUriResolver);

            Assert.Same(HardCodedTestModel.GetAddressMyNeighborsProperty(), result);
        }
Beispiel #3
0
        public void BindPropertyShouldReturnCorrectPropertyIfFoundForComplex()
        {
            var result = InnerPathTokenBinder.BindProperty(HardCodedTestModel.GetPersonAddressProp().Type, "MyNeighbors");

            result.Should().BeSameAs(HardCodedTestModel.GetAddressMyNeighborsProperty());
        }