public void GetParameters_Parses_Parameters()
        {
            var geoReqProc = new GeoRequestProcessor<Geo>();
            Expression<Func<Geo, bool>> expression =
                geo =>
                    geo.Type == GeoType.Reverse &&
                    geo.Accuracy == "10" &&
                    geo.Granularity == "city" &&
                    geo.Latitude == 37.78215 &&
                    geo.Longitude == -122.40060 &&
                    geo.MaxResults == 10 &&
                    geo.ID == "456" &&
                    geo.IP == "168.143.171.180" &&
                    geo.Query == "place" &&
                    geo.ContainedWithin == "abc" &&
                    geo.Attribute == "street_address=123" &&
                    geo.PlaceName == "placeName";

            var lambdaExpression = expression as LambdaExpression;

            var queryParams = geoReqProc.GetParameters(lambdaExpression);

            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair<string, string>("Type", ((int)GeoType.Reverse).ToString())));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair<string, string>("Accuracy", "10")));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair<string, string>("Granularity", "city")));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair<string, string>("Latitude", (37.78215).ToString())));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair<string, string>("Longitude", (-122.4006).ToString())));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair<string, string>("MaxResults", "10")));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair<string, string>("ID", "456")));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair<string, string>("IP", "168.143.171.180")));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair<string, string>("Query", "place")));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair<string, string>("ContainedWithin", "abc")));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair<string, string>("Attribute", "street_address=123")));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair<string, string>("PlaceName", "placeName")));
        }
Exemple #2
0
        public void GetParameters_Parses_Parameters()
        {
            var geoReqProc = new GeoRequestProcessor <Geo>();
            Expression <Func <Geo, bool> > expression =
                geo =>
                geo.Type == GeoType.Reverse &&
                geo.Accuracy == "10" &&
                geo.Granularity == "city" &&
                geo.Latitude == 37.78215 &&
                geo.Longitude == -122.40060 &&
                geo.MaxResults == 10 &&
                geo.ID == "456" &&
                geo.IP == "168.143.171.180" &&
                geo.Query == "place" &&
                geo.ContainedWithin == "abc" &&
                geo.Attribute == "street_address=123" &&
                geo.PlaceName == "placeName";

            var lambdaExpression = expression as LambdaExpression;

            var queryParams = geoReqProc.GetParameters(lambdaExpression);

            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair <string, string>("Type", ((int)GeoType.Reverse).ToString())));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair <string, string>("Accuracy", "10")));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair <string, string>("Granularity", "city")));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair <string, string>("Latitude", (37.78215).ToString())));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair <string, string>("Longitude", (-122.4006).ToString())));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair <string, string>("MaxResults", "10")));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair <string, string>("ID", "456")));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair <string, string>("IP", "168.143.171.180")));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair <string, string>("Query", "place")));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair <string, string>("ContainedWithin", "abc")));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair <string, string>("Attribute", "street_address=123")));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair <string, string>("PlaceName", "placeName")));
        }
        public void GetParametersTest()
        {
            var geoReqProc = new GeoRequestProcessor <Geo>();
            Expression <Func <Geo, bool> > expression =
                geo =>
                geo.Type == GeoType.Reverse &&
                geo.Accuracy == "10" &&
                geo.Granularity == "city" &&
                geo.Latitude == 37.78215 &&
                geo.Longitude == -122.40060 &&
                geo.MaxResults == 10 &&
                geo.ID == "456" &&
                geo.IP == "168.143.171.180";
            LambdaExpression lambdaExpression = expression as LambdaExpression;

            var queryParams = geoReqProc.GetParameters(lambdaExpression);

            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair <string, string>("Type", ((int)GeoType.Reverse).ToString())));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair <string, string>("Accuracy", "10")));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair <string, string>("Granularity", "city")));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair <string, string>("Latitude", "37.78215")));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair <string, string>("Longitude", "-122.4006")));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair <string, string>("MaxResults", "10")));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair <string, string>("ID", "456")));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair <string, string>("IP", "168.143.171.180")));
        }
        public void GetParametersTest()
        {
            var geoReqProc = new GeoRequestProcessor<Geo>();
            Expression<Func<Geo, bool>> expression =
                geo =>
                    geo.Type == GeoType.Reverse &&
                    geo.Accuracy == "10" &&
                    geo.Granularity == "city" &&
                    geo.Latitude == 37.78215 &&
                    geo.Longitude == -122.40060 &&
                    geo.MaxResults == 10 &&
                    geo.ID == "456" &&
                    geo.IP == "168.143.171.180";
            LambdaExpression lambdaExpression = expression as LambdaExpression;

            var queryParams = geoReqProc.GetParameters(lambdaExpression);

            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair<string, string>("Type", ((int)GeoType.Reverse).ToString())));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair<string, string>("Accuracy", "10")));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair<string, string>("Granularity", "city")));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair<string, string>("Latitude", "37.78215")));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair<string, string>("Longitude", "-122.4006")));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair<string, string>("MaxResults", "10")));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair<string, string>("ID", "456")));
            Assert.IsTrue(
                queryParams.Contains(
                    new KeyValuePair<string, string>("IP", "168.143.171.180")));
        }