예제 #1
0
        public void GeometryParameterShouldParseCorrectly()
        {
            var point = GeometryPoint.Create(1.0, 2.0);
            ICollection <OperationSegmentParameter> parsedParameters;

            TryParseOperationParameters("GetColorAtPosition", "position=geometry'" + SpatialHelpers.WriteSpatial(point) + "',includeAlpha=true", null, HardCodedTestModel.GetColorAtPositionFunction(), out parsedParameters).Should().BeTrue();
            parsedParameters.Should().HaveCount(2);
            parsedParameters.First().ShouldBeConstantParameterWithValueType("position", point);
        }
예제 #2
0
        public void GeographyParameterShouldParseCorrectly()
        {
            var point = GeographyPoint.Create(1.0, 2.0);
            ICollection <OperationSegmentParameter> parsedParameters;

            TryParseOperationParameters("GetNearbyPriorAddresses", "currentLocation=geography'" + SpatialHelpers.WriteSpatial(point) + "',limit=50", null, HardCodedTestModel.GetNearbyPriorAddressesFunction(), out parsedParameters).Should().BeTrue();
            parsedParameters.Should().HaveCount(2);
            parsedParameters.First().ShouldBeConstantParameterWithValueType("currentLocation", point);
            parsedParameters.Last().ShouldBeConstantParameterWithValueType("limit", 50);
        }
예제 #3
0
        public void GeographyAndNullParameterValuesShouldWorkInPath()
        {
            var point     = GeographyPoint.Create(1, 2);
            Uri queryUri  = new Uri("People(0)/Fully.Qualified.Namespace.GetNearbyPriorAddresses(currentLocation=geography'" + SpatialHelpers.WriteSpatial(point) + "',limit=null)", UriKind.Relative);
            Uri actualUri = UriBuilder(queryUri, ODataUrlConventions.Default, settings);

            Assert.AreEqual(new Uri("http://gobbledygook/People(0)/Fully.Qualified.Namespace.GetNearbyPriorAddresses(currentLocation=geography'" + SpatialHelpers.WriteSpatial(point) + "',limit=null)"), actualUri);
        }
예제 #4
0
        public void ParseCountAfterNonComposableFunctionShouldFail()
        {
            var    point     = GeographyPoint.Create(1, 2);
            Action parsePath = () => this.testSubject.ParsePath(new[] { "People(1)", "Fully.Qualified.Namespace.GetNearbyPriorAddresses(currentLocation=geography'" + SpatialHelpers.WriteSpatial(point) + "',limit=null)", "$count" });

            parsePath.ShouldThrow <ODataException>().WithMessage(ErrorStrings.RequestUriProcessor_MustBeLeafSegment("Fully.Qualified.Namespace.GetNearbyPriorAddresses"));
        }
예제 #5
0
        public void GeometryAndNullParameterValuesShouldWorkInPath()
        {
            var point     = GeometryPoint.Create(1, 2);
            Uri queryUri  = new Uri("Paintings(0)/Fully.Qualified.Namespace.GetColorAtPosition(position=geometry'" + SpatialHelpers.WriteSpatial(point) + "',includeAlpha=null)", UriKind.Relative);
            Uri actualUri = UriBuilder(queryUri, ODataUrlConventions.Default, settings);

            Assert.AreEqual(new Uri("http://gobbledygook/Paintings(0)/Fully.Qualified.Namespace.GetColorAtPosition(position=geometry'" + SpatialHelpers.WriteSpatial(point) + "',includeAlpha=null)"), actualUri);
        }