public void DisplayGraph(string startDateAndTime, string endDateAndTime) { WeatherPondClass.Controller.Menu menu = new WeatherPondClass.Controller.Menu(); ReadTextFiles rd = new ReadTextFiles(); List <WeatherItem> weatherItems = menu.ProcessUserDateAndTime(startDateAndTime, endDateAndTime); weatherItems = menu.PointsToGraphic(weatherItems); ChartValues <double> weatherValues = new ChartValues <double>(); Labels = new string[weatherItems.Count]; for (int i = 0; i < weatherItems.Count; i++) { Labels[i] = weatherItems[i].Date; weatherValues.Add(weatherItems[i].BarometricPress); } LineSeries lineSeries = new LineSeries(); lineSeries.Title = "Barometric pressure"; lineSeries.Values = weatherValues; this.GraphicLabels.Labels = Labels; SeriesCollection.Add(lineSeries); YFormatter = value => $"{value} Pa"; DataContext = this; this.Graphic.Visibility = Visibility.Visible; }
public void GetTimeTest() { // Arrange string dateAndTime = "2012_03_51 18"; string expectedTime = "18"; ReadTextFiles rd = new ReadTextFiles(); // Act string resultTime = rd.GetTime(dateAndTime); // Assert Assert.AreEqual(expectedTime, resultTime); }
public void GetDateTest() { // Arrange string dateAndTime = "2012_09_21 18:50:26"; string expectedDate = "2012_09_21"; ReadTextFiles rd = new ReadTextFiles(); // Act string resultDate = rd.GetDate(dateAndTime); // Assert Assert.AreEqual(expectedDate, resultDate); }
public void ReadWeatherDataTest() { // Arrange string startDateAndTime = "2012_08_19 21"; string endDateAndTime = "2012_08_19 22"; ReadTextFiles rd = new ReadTextFiles(); List <WeatherItem> expectedWeatherItems = WeatherData(); // Act List <WeatherItem> weatherItemsResult = rd.ReadYear(startDateAndTime, endDateAndTime); // Assert for (int i = 0; i < expectedWeatherItems.Count; i++) { Assert.AreEqual(expectedWeatherItems[i].ToString(), weatherItemsResult[i].ToString()); } }