Exemplo n.º 1
0
        public void WundergroundServiceReturn2()
        {
            var t = new WundergroundService(null);

            var result = _testObject.IdentifierFor(t.GetType());

            Assert.AreEqual(2, result);
        }
Exemplo n.º 2
0
        public void TestCommonUsage()
        {
            var city       = "Chelyabinsk";
            var mockLoader = new Mock <IQueryLoader>();

            mockLoader.Setup(m => m.LoadData(It.IsAny <String>())).Returns(File.ReadAllText(@"mock/wundergroundAll.txt"));
            var wundergroundService = new WundergroundService(mockLoader.Object);

            var result = wundergroundService.ForecastData(city);

            Assert.IsNotNull(result);
            Assert.AreEqual(10, result.Items.Count());
        }
Exemplo n.º 3
0
        public void ParseXmlForWundergroundForecast()
        {
            var city       = "Chelyabinsk";
            var mockLoader = new Mock <IQueryLoader>();

            mockLoader.Setup(m => m.LoadData(It.IsAny <String>())).Returns(File.ReadAllText(@"mock/wundergroundAll.txt"));
            var wundergroundService = new WundergroundService(mockLoader.Object);

            var result = wundergroundService.ForecastData(city);
            var dto    = result.Items.First();

            Assert.AreEqual(new DateTime(2014, 11, 21), dto.Date);
            Assert.AreEqual("Облачно", dto.Description);
            Assert.AreEqual(81, dto.Humidity);
            Assert.AreEqual(18, dto.WindSpeed);
            Assert.AreEqual("ЗСЗ", dto.WindDirection);
            Assert.AreEqual(-6, dto.MinTemperature);
            Assert.AreEqual(1, dto.MaxTemperature);
        }