Beispiel #1
0
        public void GivenChartAreaDataSeries_WhenUpdatedAfterChartAreaDataPointsChanged_ChartAreaDataSeriesPointsChanged()
        {
            // Given
            var chartAreaData = new ChartAreaData("Test name")
            {
                Points = new[]
                {
                    new Point2D(1.1, 2.2)
                }
            };

            var chartAreaDataSeries = new ChartAreaDataSeries(chartAreaData);

            DataPoint[] drawnPoints = chartAreaDataSeries.Points.ToArray();

            // When
            chartAreaData.Points = new[]
            {
                new Point2D(3.3, 4.4)
            };
            chartAreaDataSeries.Update();

            // Then
            CollectionAssert.AreNotEqual(drawnPoints, chartAreaDataSeries.Points);
        }
Beispiel #2
0
        private static void AssertChartAreaDataSeriesDefaultProperties(ChartAreaDataSeries chartAreaDataSeries)
        {
            Assert.AreEqual("Test name", chartAreaDataSeries.Title);
            Assert.IsTrue(chartAreaDataSeries.IsVisible);

            Assert.AreEqual(3, chartAreaDataSeries.StrokeThickness);
            Assert.AreEqual(OxyColor.FromArgb(fillColor.A, fillColor.R, fillColor.G, fillColor.B), chartAreaDataSeries.Fill);
            Assert.AreEqual(OxyColor.FromArgb(strokeColor.A, strokeColor.R, strokeColor.G, strokeColor.B), chartAreaDataSeries.Color);

            Assert.AreEqual(0, chartAreaDataSeries.Points.Count);
        }
Beispiel #3
0
        public void Constructor_ChartAreaDataWithTestProperties_ChartAreaDataSeriesCreatedAccordingly()
        {
            // Setup
            var chartAreaData = new ChartAreaData("Test name", new ChartAreaStyle
            {
                FillColor       = fillColor,
                StrokeColor     = strokeColor,
                StrokeThickness = 3
            });

            SetChartAreaDataTestProperties(chartAreaData);

            // Call
            var chartAreaDataSeries = new ChartAreaDataSeries(chartAreaData);

            // Assert
            Assert.IsInstanceOf <AreaSeries>(chartAreaDataSeries);
            Assert.IsInstanceOf <IChartDataSeries>(chartAreaDataSeries);
            AssertChartAreaDataSeriesTestProperties(chartAreaDataSeries);
        }
Beispiel #4
0
        public void GivenChartAreaDataSeries_WhenUpdatedAndChartAreaDataPointsNotChanged_PreviousChartAreaDataSeriesPointsPreserved()
        {
            // Given
            var chartAreaData = new ChartAreaData("Test name")
            {
                Points = new[]
                {
                    new Point2D(1.1, 2.2)
                }
            };

            var chartAreaDataSeries = new ChartAreaDataSeries(chartAreaData);

            DataPoint[] drawnPoints = chartAreaDataSeries.Points.ToArray();

            // When
            chartAreaDataSeries.Update();

            // Then
            CollectionAssert.AreEqual(drawnPoints, chartAreaDataSeries.Points);
        }
Beispiel #5
0
        public void Update_ChartAreaDataWithTestProperties_ChartAreaDataSeriesUpdatedAccordingly()
        {
            // Setup
            var chartAreaData = new ChartAreaData("Test name", new ChartAreaStyle
            {
                FillColor       = fillColor,
                StrokeColor     = strokeColor,
                StrokeThickness = 3
            });
            var chartAreaDataSeries = new ChartAreaDataSeries(chartAreaData);

            SetChartAreaDataTestProperties(chartAreaData);

            // Precondition
            AssertChartAreaDataSeriesDefaultProperties(chartAreaDataSeries);

            // Call
            chartAreaDataSeries.Update();

            // Assert
            AssertChartAreaDataSeriesTestProperties(chartAreaDataSeries);
        }