Exemple #1
0
        public void ApiKeyTest()
        {
            TomorrowIOHandler tmrw = new TomorrowIOHandler(APIKey);
            string            url  = tmrw.GetServiceRequestInfo().ServiceURL;

            Assert.AreEqual(APIKey, url.Remove(0, url.Length - APIKey.Length));
        }
Exemple #2
0
        public void ParseJSONTest()
        {
            string json;

            using (Stream stream = new FileStream("..\\..\\..\\TomorrowIOJSONExample.txt", FileMode.Open))
            {
                StreamReader streamReader = new StreamReader(stream);
                json = streamReader.ReadToEnd();
            }
            TomorrowIOHandler tmrw = new TomorrowIOHandler(APIKey);
            var data = tmrw.ParseJSONObject(json);

            Assert.IsNotNull(data);
            Assert.AreEqual(68, data.CloudCover);
            Assert.AreEqual(35, data.Humidity);
            Assert.AreEqual(0, data.PrecipitationProbability);
            Assert.AreEqual(PrecipitationTypes.None, data.Precipitation);
            Assert.AreEqual(6.5, data.TempC);
            Assert.AreEqual(WindDirections.W, data.WindDirection);
            Assert.AreEqual(5.38, data.WindSpeed);
        }