示例#1
0
        public void PathActionWithParens()
        {
            ODataUriParser parserWithoutparens = new ODataUriParser(model, new Uri("http://www.potato.com/"), new Uri("http://www.potato.com/People(1)/Microsoft.Test.Taupo.OData.WCFService.ChangeAddress"));
            ODataUriParser parserWithparens    = new ODataUriParser(model, new Uri("http://www.potato.com/"), new Uri("http://www.potato.com/People(1)/Microsoft.Test.Taupo.OData.WCFService.ChangeAddress()"));

            Assert.AreEqual(QueryNodeToStringVisitor.ToString(parserWithoutparens.ParsePath()), QueryNodeToStringVisitor.ToString(parserWithparens.ParsePath()));
        }
示例#2
0
        public void PathFunctionWithParens()
        {
            ODataUriParser parserWithoutparens = new ODataUriParser(model, new Uri("http://www.potato.com/"), new Uri("http://www.potato.com/Orders/Microsoft.Test.Taupo.OData.WCFService.OrdersWithMoreThanTwoItems"));
            ODataUriParser parserWithparens    = new ODataUriParser(model, new Uri("http://www.potato.com/"), new Uri("http://www.potato.com/Orders/Microsoft.Test.Taupo.OData.WCFService.OrdersWithMoreThanTwoItems()"));

            Assert.AreEqual(QueryNodeToStringVisitor.ToString(parserWithoutparens.ParsePath()), QueryNodeToStringVisitor.ToString(parserWithparens.ParsePath()));
        }
示例#3
0
        public void PathFunctionWithComplexParameters()
        {
            string inputstring = "http://www.potato.com/Customers/Microsoft.Test.Taupo.OData.WCFService.Within(Address={ Street:'1 Microsoft Way', City:'Redmond', PostalCode:'98052' }, " +
                                 "Distance=@a, Location=geography'Point(10 30 15 6)', ArbitraryInt=@b, DateTimeOffset=null, Byte=@c, LineString=@d)/" +
                                 "Microsoft.Test.Taupo.OData.WCFService.Within(Address=null, " +
                                 "Distance=5.04, ArbitraryInt=24555, DateTimeOffset=null, Byte=@f, Location=@e, LineString=@potato)";
            ODataUriParser parser = new ODataUriParser(model, new Uri("http://www.potato.com/"), new Uri(inputstring));
            var            result = parser.ParsePath();

            ApprovalVerify(QueryNodeToStringVisitor.ToString(result));

            this.TestExtensions(
                "customers/Microsoft.Test.Taupo.OData.WCFService.Within(Address={ Street:'1 Microsoft Way', City:'Redmond', PostalCode:'98052' }, " +
                "Distance=@a, LocAtion=geography'Point(10 30 15 6)', ArbitraryInt=@b, DateTimeOffset=null, Byte=@c, LineString=@d)/" +
                "Microsoft.Test.Taupo.OData.WCFService.Within(Address=null, " +
                "Distance=5.04, ArbitraryInt=24555, DateTimeOffset=null, Byte=@f, Location=@e, LineString=@potato)",
                "Customers/Within(Address={ Street:'1 Microsoft Way', City:'Redmond', PostalCode:'98052' }, " +
                "Distance=@a, Location=geography'Point(10 30 15 6)', ArbitraryInt=@b, DateTimeOffset=null, Byte=@c, LineString=@d)/" +
                "Microsoft.Test.Taupo.OData.WCFService.Within(Address=null, " +
                "Distance=5.04, ArbitraryInt=24555, DateTimeOffset=null, Byte=@f, Location=@e, LineString=@potato)",
                "customers/within(Address={ Street:'1 Microsoft Way', City:'Redmond', PostalCode:'98052' }, " +
                "Distance=@a, LocAtion=geography'Point(10 30 15 6)', ArbitraryInt=@b, DateTimeOffset=null, Byte=@c, LineString=@d)/" +
                "Within(Address=null, " +
                "Distance=5.04, ArbitraryInt=24555, DATETimeOffset=null, Byte=@f, Location=@e, LineString=@potato)");
        }
示例#4
0
        public void SelectAll()
        {
            var            selectString = "*";
            ODataUriParser parser       = this.CreateSelectUriParser(peopleBase, selectString);
            var            result       = parser.ParseSelectAndExpand();

            ApprovalVerify(QueryNodeToStringVisitor.GetTestCaseAndResultString(result, selectString, null));
        }
示例#5
0
        public void SelectFunction()
        {
            var            selectString = "Microsoft.Test.Taupo.OData.WCFService.GetOrderRate";
            ODataUriParser parser       = this.CreateSelectUriParser(orderBase, selectString);
            var            result       = parser.ParseSelectAndExpand();

            ApprovalVerify(QueryNodeToStringVisitor.GetTestCaseAndResultString(result, selectString, null));
        }
示例#6
0
        public void PathLinks()
        {
            ODataUriParser parser = new ODataUriParser(model, new Uri("http://www.potato.com/"), new Uri("http://www.potato.com/Customers(-21)/Orders/$ref"));
            var            result = parser.ParsePath();

            ApprovalVerify(QueryNodeToStringVisitor.ToString(result));

            this.TestExtensions("CusTomers(-21)/OrDers/$REF");
        }
示例#7
0
        public void PathComplex()
        {
            ODataUriParser parser = new ODataUriParser(model, new Uri("http://www.potato.com/"), new Uri("http://www.potato.com/Customers(-32)/HomeAddress"));
            var            result = parser.ParsePath();

            ApprovalVerify(QueryNodeToStringVisitor.ToString(result));

            this.TestExtensions("CustomErs(-32)/HOMEAddress");
        }
示例#8
0
        public void PathCollection()
        {
            ODataUriParser parser = new ODataUriParser(model, new Uri("http://www.potato.com/"), new Uri("http://www.potato.com/People(1)/Numbers"));
            var            result = parser.ParsePath();

            ApprovalVerify(QueryNodeToStringVisitor.ToString(result));

            this.TestExtensions("people(1)/numbers");
        }
示例#9
0
        public void PathEntityWithDurationKey()
        {
            ODataUriParser parser = new ODataUriParser(model, new Uri("http://www.potato.com/"), new Uri("http://www.potato.com/DurationInKeys(duration'P1DT2H3M4.5678901S')"));
            var            result = parser.ParsePath();

            ApprovalVerify(QueryNodeToStringVisitor.ToString(result));

            this.TestExtensions("durationinkeys(dUration'P1DT2H3M4.5678901S')");
        }
示例#10
0
        public void PathEntity()
        {
            ODataUriParser parser = new ODataUriParser(model, new Uri("http://www.potato.com/"), new Uri("http://www.potato.com/Orders(2)"));
            var            result = parser.ParsePath();

            ApprovalVerify(QueryNodeToStringVisitor.ToString(result));

            this.TestExtensions("OrDERS(2)");
        }
示例#11
0
        public void PathBatch()
        {
            ODataUriParser parser = new ODataUriParser(model, new Uri("http://www.potato.com/"), new Uri("http://www.potato.com/$batch"));
            var            result = parser.ParsePath();

            ApprovalVerify(QueryNodeToStringVisitor.ToString(result));

            this.TestExtensions("$BATch");
        }
示例#12
0
        public void PathNavigation()
        {
            ODataUriParser parser = new ODataUriParser(model, new Uri("http://www.potato.com/"), new Uri("http://www.potato.com/Customers(5)/Orders"));
            var            result = parser.ParsePath();

            ApprovalVerify(QueryNodeToStringVisitor.ToString(result));

            this.TestExtensions("CustoMERS(5)/OrDErs");
        }
示例#13
0
        public void PathPrimitive()
        {
            ODataUriParser parser = new ODataUriParser(model, new Uri("http://www.potato.com/"), new Uri("http://www.potato.com/Customers(0)/FirstName"));
            var            result = parser.ParsePath();

            ApprovalVerify(QueryNodeToStringVisitor.ToString(result));

            this.TestExtensions("CustomERS(0)/FiRStName");
        }
示例#14
0
        public void PathEntityWithDurationKeyUsingKeyAsSegmments()
        {
            ODataUriParser parser = new ODataUriParser(model, new Uri("http://www.potato.com/"), new Uri("http://www.potato.com/DurationInKeys/P1DT2H3M4.5678901S"));

            parser.UrlKeyDelimiter = ODataUrlKeyDelimiter.Slash;
            var result = parser.ParsePath();

            ApprovalVerify(QueryNodeToStringVisitor.ToString(result));
        }
示例#15
0
        public void PathTypeSegmentWithODataSimplifiedEnabled()
        {
            ODataUriParser parser = new ODataUriParser(model, new Uri("http://www.potato.com/"), new Uri("http://www.potato.com/Schools(1)/Student/Microsoft.Test.Taupo.OData.WCFService.Customer"))
            {
                UrlKeyDelimiter = ODataUrlKeyDelimiter.Slash
            };
            var result = parser.ParsePath();

            ApprovalVerify(QueryNodeToStringVisitor.ToString(result));
        }
示例#16
0
        public void RedundantlyParserFilter()
        {
            const string   queryOption = "AssociatedOrder($filter=CustomerID eq null)";
            ODataUriParser parser      = this.CreateExpandUriParser(orderDetailBase, queryOption);
            var            result      = parser.ParseSelectAndExpand();

            ApprovalVerify(QueryNodeToStringVisitor.GetTestCaseAndResultString(result, null, queryOption));
            result = parser.ParseSelectAndExpand();
            ApprovalVerify(QueryNodeToStringVisitor.GetTestCaseAndResultString(result, null, queryOption));
        }
示例#17
0
        public void PathKeysAsSegmentsWithODataSimplifiedEnabled()
        {
            var parser = new ODataUriParser(model, new Uri("http://www.potato.com/"), new Uri("http://www.potato.com/Schools/1/Student/Microsoft.Test.Taupo.OData.WCFService.Customer"))
            {
                UrlConventions = ODataUrlConventions.ODataSimplified
            };
            var result = parser.ParsePath();

            ApprovalVerify(QueryNodeToStringVisitor.ToString(result));
        }
示例#18
0
        public void PathKeysAsSegments()
        {
            var parser = new ODataUriParser(model, new Uri("http://www.potato.com/"), new Uri("http://www.potato.com/Customers/5"))
            {
                UrlKeyDelimiter = ODataUrlKeyDelimiter.Slash
            };
            var result = parser.ParsePath();

            ApprovalVerify(QueryNodeToStringVisitor.ToString(result));
        }
示例#19
0
        public void PathFunctionInContainedEntity()
        {
            ODataUriParser parser = new ODataUriParser(model, new Uri("http://www.potato.com/"), new Uri("http://www.potato.com/People(1)/FirstOrder/Microsoft.Test.Taupo.OData.WCFService.GetOrderRate"));
            var            result = parser.ParsePath();

            ApprovalVerify(QueryNodeToStringVisitor.ToString(result));

            this.TestExtensions("People(1)/FirstORDER/Microsoft.TESt.Taupo.ODaTa.WCFService.GetOrderRate",
                                "People(1)/FirstOrder/GetOrderRate",
                                "PeopLE(1)/FirstOrder/getorderrate");
        }
示例#20
0
        public void PathFunction()
        {
            ODataUriParser parser = new ODataUriParser(model, new Uri("http://www.potato.com/"), new Uri("http://www.potato.com/Orders/Microsoft.Test.Taupo.OData.WCFService.OrdersWithMoreThanTwoItems"));
            var            result = parser.ParsePath();

            ApprovalVerify(QueryNodeToStringVisitor.ToString(result));

            this.TestExtensions("Orders/Microsoft.Test.Taupo.OData.WCFService.OrdersWithMoreThanTwoitems",
                                "Orders/OrdersWithMoreThanTwoItems",
                                "Orders/OrdersWithMoreThanTwoITEMS");
        }
示例#21
0
        public void PathFunctionAliasedParameterWithResolver()
        {
            ODataUriParser parser = new ODataUriParser(model, new Uri("http://www.potato.com/"), new Uri("http://www.potato.com/Customers/Microsoft.Test.Taupo.OData.WCFService.InCity(City=@a)?@a='Redmond'"));
            var            result = parser.ParsePath();

            ApprovalVerify(QueryNodeToStringVisitor.ToString(result));

            this.TestExtensions("customers/Microsoft.Test.Taupo.OData.wcfservice.InCity(city=@a)?@a='Redmond'",
                                "Customers/InCity(City=@a)?@a='Redmond'",
                                "customers/incity(CITY=@a)?@a='Redmond'");
        }
示例#22
0
        public void PathFunctionWithAliasedParameter()
        {
            ODataUriParser parser = new ODataUriParser(model, new Uri("http://www.potato.com/"), new Uri("http://www.potato.com/Customers/Microsoft.Test.Taupo.OData.WCFService.InCity(City=@a)"));
            var            result = parser.ParsePath();

            ApprovalVerify(QueryNodeToStringVisitor.ToString(result));

            this.TestExtensions("Customers/Microsoft.TESt.Taupo.OData.WCFService.InCity(CiTy=@a)",
                                "Customers/InCity(City=@a)",
                                "Customers/inCity(CiTy=@a)");
        }
示例#23
0
        public void PathAction()
        {
            ODataUriParser parser = new ODataUriParser(model, new Uri("http://www.potato.com/"), new Uri("http://www.potato.com/People(1)/Microsoft.Test.Taupo.OData.WCFService.ChangeAddress"));
            var            result = parser.ParsePath();

            ApprovalVerify(QueryNodeToStringVisitor.ToString(result));

            this.TestExtensions("PEOPLE(1)/Microsoft.Test.Taupo.ODATA.WCFService.ChangeAddress",
                                "People(1)/ChangeAddress",
                                "people(1)/changeaddress");
        }
示例#24
0
        public void PathFunctionOnEntity()
        {
            ODataUriParser parser = new ODataUriParser(model, new Uri("http://www.potato.com/"), new Uri("http://www.potato.com/Orders(1)/Microsoft.Test.Taupo.OData.WCFService.GetOrderRate"));
            var            result = parser.ParsePath();

            ApprovalVerify(QueryNodeToStringVisitor.ToString(result));

            this.TestExtensions("Orders(1)/Microsoft.Test.Taupo.OData.WCFService.GetOrderRatE",
                                "Orders(1)/GetOrderRate",
                                "ORDErs(1)/GETORDERrate");
        }
示例#25
0
        public void PathTypeSegmentToNavigation()
        {
            ODataUriParser parser = new ODataUriParser(model, new Uri("http://www.potato.com/"), new Uri("http://www.potato.com/People(1)/Microsoft.Test.Taupo.OData.WCFService.Customer/Orders"));
            var            result = parser.ParsePath();

            ApprovalVerify(QueryNodeToStringVisitor.ToString(result));

            this.TestExtensions("people(1)/microsoft.test.taupo.ODATA.WCFService.Customer/OrderS");
            //, Unqualified type not supported yet.
            //"People(1)/Customer/Orders",
            //"People(1)/customer/Orders");
        }
示例#26
0
 private void TestAllInOneExtensionOrderBy(Uri baseUri, string orderby, string origOrderby)
 {
     this.TestExtension(
         this.CreateOrderByUriParser(baseUri, orderby),
         new AllInOneResolver()
     {
         EnableCaseInsensitive = true
     },
         parser => parser.ParseOrderBy(),
         clause => QueryNodeToStringVisitor.GetTestCaseAndResultString(clause, origOrderby),
         this.ApprovalVerify);
 }
示例#27
0
 private void TestAllInOneExtensionFilter(Uri baseUri, string filter, string origFilter)
 {
     this.TestExtension(
         this.CreateFilterUriParser(baseUri, filter),
         new AllInOneResolver()
     {
         EnableCaseInsensitive = true
     },
         parser => parser.ParseFilter(),
         clause => QueryNodeToStringVisitor.GetTestCaseAndResultString(clause, origFilter),
         this.ApprovalVerify);
 }
示例#28
0
        public void RedundantlyParserFilter()
        {
            const string   queryOption = "CustomerID eq null";
            ODataUriParser parser      = this.CreateFilterUriParser(orderBase, queryOption);
            var            result      = parser.ParseFilter();

            ApprovalVerify(QueryNodeToStringVisitor.GetTestCaseAndResultString(result, queryOption));
            result = parser.ParseFilter();
            ApprovalVerify(QueryNodeToStringVisitor.GetTestCaseAndResultString(result, queryOption));

            this.TestAllInOneExtensionFilter(
                orderBase,
                "customerid eQ null",
                "CustomerID eq null");
        }
示例#29
0
        public void PathActionReturnsContainedEntity()
        {
            ODataUriParser parser = new ODataUriParser(model, new Uri("http://www.potato.com/"), new Uri("http://www.potato.com/People(1)/Microsoft.Test.Taupo.OData.WCFService.GetBrothers"));
            var            result = parser.ParsePath();

            ApprovalVerify(QueryNodeToStringVisitor.ToString(result));
            OperationSegment operationSegment = result.LastSegment as OperationSegment;

            Assert.IsNotNull(operationSegment);
            Assert.IsTrue(operationSegment.EntitySet is IEdmContainedEntitySet);

            this.TestExtensions("people(1)/microsoft.Test.Taupo.OData.WCFService.GetBrothers",
                                "People(1)/GetBrothers",
                                "people(1)/getbrothers");
        }