public void GivenMultipleAreaSeriesAddedToView_WhenViewOpenedAndUpdated_ThenXYAxisIncludesSeriesValues() { // Given const int maxY = 100; const int minY = -25; const int maxX = 50; const int minX = -10; var series = new MultipleAreaSeries { Areas = { new[] { new DataPoint(minX, maxY) }, new[] { new DataPoint(maxX, minY) } } }; using (var form = new Form()) using (var view = new LinearPlotView()) { form.Controls.Add(view); view.Model.Series.Add(series); // When form.Show(); view.Update(); } // Then Assert.AreEqual(maxX, series.XAxis.DataMaximum); Assert.AreEqual(minX, series.XAxis.DataMinimum); Assert.AreEqual(maxY, series.YAxis.DataMaximum); Assert.AreEqual(minY, series.YAxis.DataMinimum); }
public void GivenEmptyMultipleAreaSeriesAddedToView_WhenViewOpenedAndUpdated_ThenXYAxisNotChanged() { // Given var series = new MultipleAreaSeries(); using (var form = new Form()) using (var view = new LinearPlotView()) { form.Controls.Add(view); view.Model.Series.Add(series); // When form.Show(); view.Update(); } // Then Assert.AreEqual(double.NaN, series.XAxis.DataMaximum); Assert.AreEqual(double.NaN, series.XAxis.DataMinimum); Assert.AreEqual(double.NaN, series.YAxis.DataMaximum); Assert.AreEqual(double.NaN, series.YAxis.DataMinimum); }