public void Test_SelectLongTermEntry_SecondOne() { //Arrange IWeatherUtils weatherUtils = new WeatherUtils(new SystemClock()); var forecast = new ForecastLongTerm(); var entry1 = new ForecastDailyEntry(); entry1.UnixTimestamp = 1335913200; //2012/05/01 23:00 var entry2 = new ForecastDailyEntry(); entry2.UnixTimestamp = 1335927600; //2012/05/02 03:00 forecast.Entries = new List <ForecastDailyEntry>() { entry1, entry2 }; var locDetail = new LocationDetail(); locDetail.Time = new DateTime(2012, 5, 1, 0, 0, 0); //Act var entry = weatherUtils.SelectLongTermEntry(locDetail, forecast); //Assert - entry2 should be selected Assert.AreEqual(1335913200, entry.UnixTimestamp); }
public void Test_SelectLongTermEntry_Argument1Null() { IWeatherUtils weatherUtils = new WeatherUtils(new SystemClock()); var fc = new ForecastLongTerm(); weatherUtils.SelectLongTermEntry(null, fc); }
public void Test_SelectLongTermEntry_NoEntries() { IWeatherUtils weatherUtils = new WeatherUtils(new SystemClock()); LocationDetail loc = new LocationDetail(); var fc = new ForecastLongTerm(); fc.Entries = new List <ForecastDailyEntry>(); var result = weatherUtils.SelectLongTermEntry(loc, fc); Assert.AreEqual("N/A", result.WeatherDescription[0].Description); }