コード例 #1
0
        public void QueryWithRectangleFilter()
        {
            var filter = new Rectangle(47.622525, -122.353599, 47.618244, -122.340339);

            String  result = Factual.Query("t/places", filter);
            dynamic json   = JsonConvert.DeserializeObject(result);

            Assert.AreEqual("ok", (string)json.status);
            Assert.IsTrue(result.Contains("Space Needle"));
        }
コード例 #2
0
        public void FullTextSearch()
        {
            // Arrange
            var filter = new SearchFilter("vegan,Los Angeles");

            // Act
            string  result = Factual.Query("t/restaurants", filter);
            dynamic json   = JsonConvert.DeserializeObject(result);

            // Assert
            Assert.AreEqual("ok", (string)json.status);
        }
コード例 #3
0
        public void QueryWithGeoFilter()
        {
            // Arrange
            var filter = new GeoFilter(34.06018, -118.41835, 500);

            // Act
            string  result = Factual.Query("t/global", filter);
            dynamic json   = JsonConvert.DeserializeObject(result);

            // Assert
            Assert.AreEqual("ok", (string)json.status);
        }
コード例 #4
0
        public void QueryWithBeginFilter()
        {
            // Arrange
            var filter = new RowFilter("name", "$bw", "$Star");

            // Act
            string  result = Factual.Query("t/global", filter);
            dynamic json   = JsonConvert.DeserializeObject(result);

            // Assert
            Assert.AreEqual("ok", (string)json.status);
        }
コード例 #5
0
        public void QueryWithSimpleRowFilter()
        {
            // Arrange
            var filter = new RowFilter("country", "US");

            // Act
            string  result = Factual.Query("t/global", filter);
            dynamic json   = JsonConvert.DeserializeObject(result);

            // Assert
            Assert.AreEqual("ok", (string)json.status);
        }
コード例 #6
0
        public void GeoAndRowFilterTest()
        {
            // Arrange
            var filter  = new RowFilter("name", "Stand");
            var filter2 = new GeoFilter(34.06018, -118.41835, 5000);

            // Act
            string  result = Factual.Query("t/restaurants", filter, filter2);
            dynamic json   = JsonConvert.DeserializeObject(result);

            // Assert
            Assert.AreEqual("ok", (string)json.status);
        }
コード例 #7
0
        public void MultipleFiltersTest()
        {
            // Arrange
            var filter  = new RowFilter("name", "$bw", "Star");
            var filter2 = new Filter("include_count", "true");

            // Act
            string  result = Factual.Query("t/restaurants", filter, filter2);
            dynamic json   = JsonConvert.DeserializeObject(result);

            // Assert
            Assert.AreEqual("ok", (string)json.status);
        }
コード例 #8
0
        public void ParametersWithConditionalOperators()
        {
            // Arrange
            var filter = new FilterGroup(new List <IFilter>
            {
                new RowFilter("name", "$search", "McDonald's"),
                new RowFilter("category", "$bw", "Food & Beverage")
            });



            // Act
            string  result = Factual.Query("t/global", filter);
            dynamic json   = JsonConvert.DeserializeObject(result);

            // Assert
            Assert.AreEqual("ok", (string)json.status);
        }