public void GetDataFromOpenWeatherTest() { var fakeSite = new Mock <IRequest>(); fakeSite.Setup(r => r.Connected).Returns(true); fakeSite.Setup(r => r.Response).Returns("{\"coord\":{\"lon\":30.2642,\"lat\":59.8944},\"weather\":[{\"id\":800,\"main\":\"Clear\",\"description\":\"clear sky\",\"icon\":\"01n\"}],\"base\":\"stations\",\"main\":{\"temp\":275.93,\"feels_like\":273.93,\"temp_min\":273.8,\"temp_max\":275.96,\"pressure\":1019,\"humidity\":45},\"visibility\":10000,\"wind\":{\"speed\":2,\"deg\":200},\"clouds\":{\"all\":0},\"dt\":1651174866,\"sys\":{\"type\":2,\"id\":197864,\"country\":\"RU\",\"sunrise\":1651111556,\"sunset\":1651168004},\"timezone\":10800,\"id\":498817,\"name\":\"Saint Petersburg\",\"cod\":200}"); OpenWeather openWeather = new OpenWeather(fakeSite.Object); Weather data = openWeather.GetData(); var correct = new Weather(2.78, 37, 0, 45, 2, "S", "Clear"); Assert.AreEqual(correct.TemperatureCelsius, data.TemperatureCelsius); Assert.AreEqual(correct.Humidity, data.Humidity); Assert.AreEqual(correct.TemperatureFahrenheit, data.TemperatureFahrenheit); Assert.AreEqual(correct.CloudCover, data.CloudCover); Assert.AreEqual(correct.WindSpeed, data.WindSpeed); Assert.AreEqual(correct.WindDirection, data.WindDirection); Assert.AreEqual(correct.Precipitation, data.Precipitation); fakeSite.Setup(r => r.Connected).Returns(false); try { openWeather.GetData(); } catch { Assert.Pass(); } Assert.Fail(); }