コード例 #1
0
        public void RowFilterSerializationNumeric()
        {
            // Arrange
            var filter = new RowFilter("rating", "$gte", 7.5);

            // Act
            var result = JsonConvert.SerializeObject(filter);

            // Assert
            Assert.AreEqual("{\"rating\":{\"$gte\":7.5}}", result);
        }
コード例 #2
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-us", filter, filter2);
            dynamic json = JsonConvert.DeserializeObject(result);

            // Assert
            Assert.AreEqual("ok", (string)json.status);
        }
コード例 #3
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-us", filter, filter2);
            dynamic json = JsonConvert.DeserializeObject(result);

            // Assert
            Assert.AreEqual("ok", (string)json.status);
        }
コード例 #4
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);
        }
コード例 #5
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);
        }
コード例 #6
0
        public void RowFilterSerializationWithArray()
        {
            // Arrange
            var filter = new RowFilter("locality", "$nin", new[] {"Los Angeles", "Northridge"});

            // Act
            var result = JsonConvert.SerializeObject(filter);

            // Assert
            Assert.AreEqual("{\"locality\":{\"$nin\":[\"Los Angeles\",\"Northridge\"]}}", result);
        }