private DailySwellData GetDailySwellData(IEnumerable <HtmlNode> dayNodes) { DailySwellData dailySwellData = new DailySwellData() { Date = dayNodes.FirstOrDefault().GetAttributeValue("data-date-anchor", "Date not found") }; for (int dayNode = 1; dayNode <= dayNodes.Count(); dayNode++) { dailySwellData.Add((ForecastHour)dayNode, GetHourlySwellData(dayNodes.ElementAt(dayNode - 1))); } return(dailySwellData); }
private void AssertDailySwellData(int day, DailySwellData dailySwellData) { dailySwellData.Date.Should().NotBeNullOrEmpty(); dailySwellData.Count.Should().Be(8); for (int forecastHour = 1; forecastHour <= dailySwellData.Count; forecastHour++) { bool hasValueForHour = dailySwellData.TryGetValue((ForecastHour)forecastHour, out HourlySwellData hourlySwellData); hasValueForHour.Should().BeTrue(); switch (day) { case 1: dailySwellData.Date.Should().BeEquivalentTo("Thursday1911"); switch (forecastHour) { case (int)ForecastHour.Hour_12am: hourlySwellData.FullStars.Should().Be(5); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(0); break; case (int)ForecastHour.Hour_3am: hourlySwellData.FullStars.Should().Be(5); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(0); break; case (int)ForecastHour.Hour_6am: hourlySwellData.FullStars.Should().Be(4); hourlySwellData.BlurredStars.Should().Be(1); hourlySwellData.EmptyStars.Should().Be(0); break; case (int)ForecastHour.Hour_9am: hourlySwellData.FullStars.Should().Be(3); hourlySwellData.BlurredStars.Should().Be(2); hourlySwellData.EmptyStars.Should().Be(0); break; case (int)ForecastHour.Hour_Noon: hourlySwellData.FullStars.Should().Be(2); hourlySwellData.BlurredStars.Should().Be(2); hourlySwellData.EmptyStars.Should().Be(1); break; case (int)ForecastHour.Hour_3pm: hourlySwellData.FullStars.Should().Be(3); hourlySwellData.BlurredStars.Should().Be(1); hourlySwellData.EmptyStars.Should().Be(1); break; case (int)ForecastHour.Hour_6pm: hourlySwellData.FullStars.Should().Be(3); hourlySwellData.BlurredStars.Should().Be(1); hourlySwellData.EmptyStars.Should().Be(1); break; case (int)ForecastHour.Hour_9pm: hourlySwellData.FullStars.Should().Be(4); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(1); break; default: break; } break; case 2: dailySwellData.Date.Should().BeEquivalentTo("Friday2011"); switch (forecastHour) { case (int)ForecastHour.Hour_12am: hourlySwellData.FullStars.Should().Be(3); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(2); break; case (int)ForecastHour.Hour_3am: hourlySwellData.FullStars.Should().Be(4); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(1); break; case (int)ForecastHour.Hour_6am: hourlySwellData.FullStars.Should().Be(4); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(1); break; case (int)ForecastHour.Hour_9am: hourlySwellData.FullStars.Should().Be(4); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(1); break; case (int)ForecastHour.Hour_Noon: hourlySwellData.FullStars.Should().Be(4); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(1); break; case (int)ForecastHour.Hour_3pm: hourlySwellData.FullStars.Should().Be(3); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(2); break; case (int)ForecastHour.Hour_6pm: hourlySwellData.FullStars.Should().Be(3); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(2); break; case (int)ForecastHour.Hour_9pm: hourlySwellData.FullStars.Should().Be(3); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(2); break; default: break; } break; case 3: dailySwellData.Date.Should().BeEquivalentTo("Saturday2111"); switch (forecastHour) { case (int)ForecastHour.Hour_12am: hourlySwellData.FullStars.Should().Be(2); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(3); break; case (int)ForecastHour.Hour_3am: hourlySwellData.FullStars.Should().Be(2); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(3); break; case (int)ForecastHour.Hour_6am: hourlySwellData.FullStars.Should().Be(2); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(3); break; case (int)ForecastHour.Hour_9am: hourlySwellData.FullStars.Should().Be(3); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(2); break; case (int)ForecastHour.Hour_Noon: hourlySwellData.FullStars.Should().Be(4); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(1); break; case (int)ForecastHour.Hour_3pm: hourlySwellData.FullStars.Should().Be(4); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(1); break; case (int)ForecastHour.Hour_6pm: hourlySwellData.FullStars.Should().Be(5); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(0); break; case (int)ForecastHour.Hour_9pm: hourlySwellData.FullStars.Should().Be(5); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(0); break; default: break; } break; case 4: dailySwellData.Date.Should().BeEquivalentTo("Sunday2211"); switch (forecastHour) { case (int)ForecastHour.Hour_12am: hourlySwellData.FullStars.Should().Be(5); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(0); break; case (int)ForecastHour.Hour_3am: hourlySwellData.FullStars.Should().Be(5); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(0); break; case (int)ForecastHour.Hour_6am: hourlySwellData.FullStars.Should().Be(5); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(0); break; case (int)ForecastHour.Hour_9am: hourlySwellData.FullStars.Should().Be(5); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(0); break; case (int)ForecastHour.Hour_Noon: hourlySwellData.FullStars.Should().Be(5); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(0); break; case (int)ForecastHour.Hour_3pm: hourlySwellData.FullStars.Should().Be(5); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(0); break; case (int)ForecastHour.Hour_6pm: hourlySwellData.FullStars.Should().Be(5); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(0); break; case (int)ForecastHour.Hour_9pm: hourlySwellData.FullStars.Should().Be(4); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(1); break; default: break; } break; case 5: dailySwellData.Date.Should().BeEquivalentTo("Monday2311"); switch (forecastHour) { case (int)ForecastHour.Hour_12am: hourlySwellData.FullStars.Should().Be(4); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(1); break; case (int)ForecastHour.Hour_3am: hourlySwellData.FullStars.Should().Be(2); hourlySwellData.BlurredStars.Should().Be(2); hourlySwellData.EmptyStars.Should().Be(1); break; case (int)ForecastHour.Hour_6am: hourlySwellData.FullStars.Should().Be(2); hourlySwellData.BlurredStars.Should().Be(2); hourlySwellData.EmptyStars.Should().Be(1); break; case (int)ForecastHour.Hour_9am: hourlySwellData.FullStars.Should().Be(2); hourlySwellData.BlurredStars.Should().Be(1); hourlySwellData.EmptyStars.Should().Be(2); break; case (int)ForecastHour.Hour_Noon: hourlySwellData.FullStars.Should().Be(1); hourlySwellData.BlurredStars.Should().Be(2); hourlySwellData.EmptyStars.Should().Be(2); break; case (int)ForecastHour.Hour_3pm: hourlySwellData.FullStars.Should().Be(2); hourlySwellData.BlurredStars.Should().Be(1); hourlySwellData.EmptyStars.Should().Be(2); break; case (int)ForecastHour.Hour_6pm: hourlySwellData.FullStars.Should().Be(2); hourlySwellData.BlurredStars.Should().Be(1); hourlySwellData.EmptyStars.Should().Be(2); break; case (int)ForecastHour.Hour_9pm: hourlySwellData.FullStars.Should().Be(3); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(2); break; default: break; } break; case 6: dailySwellData.Date.Should().BeEquivalentTo("Tuesday2411"); switch (forecastHour) { case (int)ForecastHour.Hour_12am: hourlySwellData.FullStars.Should().Be(3); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(2); break; case (int)ForecastHour.Hour_3am: hourlySwellData.FullStars.Should().Be(3); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(2); break; case (int)ForecastHour.Hour_6am: hourlySwellData.FullStars.Should().Be(3); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(2); break; case (int)ForecastHour.Hour_9am: hourlySwellData.FullStars.Should().Be(3); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(2); break; case (int)ForecastHour.Hour_Noon: hourlySwellData.FullStars.Should().Be(2); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(3); break; case (int)ForecastHour.Hour_3pm: hourlySwellData.FullStars.Should().Be(0); hourlySwellData.BlurredStars.Should().Be(2); hourlySwellData.EmptyStars.Should().Be(3); break; case (int)ForecastHour.Hour_6pm: hourlySwellData.FullStars.Should().Be(0); hourlySwellData.BlurredStars.Should().Be(2); hourlySwellData.EmptyStars.Should().Be(3); break; case (int)ForecastHour.Hour_9pm: hourlySwellData.FullStars.Should().Be(1); hourlySwellData.BlurredStars.Should().Be(1); hourlySwellData.EmptyStars.Should().Be(3); break; default: break; } break; case 7: dailySwellData.Date.Should().BeEquivalentTo("Wednesday2511"); switch (forecastHour) { case (int)ForecastHour.Hour_12am: hourlySwellData.FullStars.Should().Be(3); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(2); break; case (int)ForecastHour.Hour_3am: hourlySwellData.FullStars.Should().Be(4); hourlySwellData.BlurredStars.Should().Be(0); hourlySwellData.EmptyStars.Should().Be(1); break; case (int)ForecastHour.Hour_6am: hourlySwellData.FullStars.Should().Be(0); hourlySwellData.BlurredStars.Should().Be(4); hourlySwellData.EmptyStars.Should().Be(1); break; case (int)ForecastHour.Hour_9am: hourlySwellData.FullStars.Should().Be(0); hourlySwellData.BlurredStars.Should().Be(4); hourlySwellData.EmptyStars.Should().Be(1); break; case (int)ForecastHour.Hour_Noon: hourlySwellData.FullStars.Should().Be(0); hourlySwellData.BlurredStars.Should().Be(4); hourlySwellData.EmptyStars.Should().Be(1); break; case (int)ForecastHour.Hour_3pm: hourlySwellData.FullStars.Should().Be(0); hourlySwellData.BlurredStars.Should().Be(4); hourlySwellData.EmptyStars.Should().Be(1); break; case (int)ForecastHour.Hour_6pm: hourlySwellData.FullStars.Should().Be(2); hourlySwellData.BlurredStars.Should().Be(2); hourlySwellData.EmptyStars.Should().Be(1); break; case (int)ForecastHour.Hour_9pm: hourlySwellData.FullStars.Should().Be(1); hourlySwellData.BlurredStars.Should().Be(4); hourlySwellData.EmptyStars.Should().Be(0); break; default: break; } break; default: break; } } }