Exemple #1
0
        public void JsonDataReader_Demandbase_IP_Localhost_Test()
        {
            var reader = new JsonDataReader()
            {
                Endpoint = "http://api.demandbase.com/api/v2/ip.json"
            };

            reader.Parameters.Add("key", DEMANDBASE_API_KEY);
            reader.Parameters.Add("query", "127.0.0.1");
            var stream = reader.GetDataStream();

            Assert.IsNull(stream);
        }
Exemple #2
0
        public void JsonDataReader_Demandbase_IP_Test()
        {
            var reader = new JsonDataReader()
            {
                Endpoint = "http://api.demandbase.com/api/v2/ip.json"
            };

            reader.Parameters.Add("key", DEMANDBASE_API_KEY);
            reader.Parameters.Add("query", "24.22.14.68");
            var stream = reader.GetDataStream();

            Assert.IsNotNull(stream);
            var stream2 = new StreamReader(stream, Encoding.UTF8);
            var data    = stream2.ReadToEnd();

            Assert.IsNotNull(data);
            var obj = JsonConvert.DeserializeObject(data);

            Assert.IsNotNull(obj);
        }
Exemple #3
0
        public void JsonDataReader_Bizo_Classify_Test()
        {
            var reader = new JsonDataReader()
            {
                Endpoint = "http://api.bizographics.com/v4/classify.json"
            };

            reader.UseOauth    = true;
            reader.OAuthApiKey = BIZO_OAUTH_API_KEY;
            reader.OAuthSecret = BIZO_OAUTH_SECRET;
            reader.Parameters.Add("api_key", reader.OAuthApiKey);
            reader.Parameters.Add("secret", reader.OAuthSecret);
            reader.Parameters.Add("ip_address", "206.108.40.109");
            var stream = reader.GetDataStream();

            Assert.IsNotNull(stream);
            var stream2 = new StreamReader(stream, Encoding.UTF8);
            var data    = stream2.ReadToEnd();

            Assert.IsNotNull(data);
            var obj = JsonConvert.DeserializeObject(data);

            Assert.IsNotNull(obj);
        }