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)"); }
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())); }
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())); }
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"); }
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"); }
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')"); }
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)); }
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"); }
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"); }
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)"); }
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"); }
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"); }
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)); }
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)); }
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)); }
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"); }
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"); }
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"); }
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'"); }
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)"); }
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"); }
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"); }
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"); }