Пример #1
0
        private static void AssertChartPointDataSeriesDefaultProperties(ChartPointDataSeries chartPointDataSeries)
        {
            Assert.AreEqual("Test name", chartPointDataSeries.Title);
            Assert.IsTrue(chartPointDataSeries.IsVisible);

            Assert.AreEqual(4, chartPointDataSeries.MarkerSize);
            Assert.AreEqual(OxyColor.FromArgb(color.A, color.R, color.G, color.B), chartPointDataSeries.MarkerFill);
            Assert.AreEqual(OxyColor.FromArgb(strokeColor.A, strokeColor.R, strokeColor.G, strokeColor.B), chartPointDataSeries.MarkerStroke);
            Assert.AreEqual(2, chartPointDataSeries.MarkerStrokeThickness);
            Assert.AreEqual(MarkerType.Circle, chartPointDataSeries.MarkerType);

            Assert.AreEqual(0, chartPointDataSeries.ItemsSource.Cast <DataPoint>().Count());
        }
Пример #2
0
        public void GivenChartPointDataSeries_WhenUpdatedAndChartPointDataPointsNotChanged_PreviousChartPointDataSeriesPointsPreserved()
        {
            // Given
            var chartPointData = new ChartPointData("Test name")
            {
                Points = new[]
                {
                    new Point2D(1.1, 2.2)
                }
            };

            var chartPointDataSeries            = new ChartPointDataSeries(chartPointData);
            IEnumerable <DataPoint> drawnPoints = chartPointDataSeries.ItemsSource.Cast <DataPoint>();

            // When
            chartPointDataSeries.Update();

            // Then
            CollectionAssert.AreEqual(drawnPoints, chartPointDataSeries.ItemsSource.Cast <DataPoint>());
        }
Пример #3
0
        public void Constructor_ChartPointDataWithTestProperties_ChartPointDataSeriesCreatedAccordingly()
        {
            // Setup
            var chartPointData = new ChartPointData("Test name", new ChartPointStyle
            {
                Color           = color,
                StrokeColor     = strokeColor,
                Size            = 4,
                StrokeThickness = 2,
                Symbol          = ChartPointSymbol.Circle
            });

            SetChartPointDataTestProperties(chartPointData);

            // Call
            var chartPointDataSeries = new ChartPointDataSeries(chartPointData);

            // Assert
            Assert.IsInstanceOf <LineSeries>(chartPointDataSeries);
            Assert.IsInstanceOf <IChartDataSeries>(chartPointDataSeries);
            AssertChartPointDataSeriesTestProperties(chartPointDataSeries);
        }
Пример #4
0
        public void Update_ChartPointDataWithTestProperties_ChartPointDataSeriesUpdatedAccordingly()
        {
            // Setup
            var chartPointData = new ChartPointData("Test name", new ChartPointStyle
            {
                Color           = color,
                StrokeColor     = strokeColor,
                Size            = 4,
                StrokeThickness = 2,
                Symbol          = ChartPointSymbol.Circle
            });
            var chartPointDataSeries = new ChartPointDataSeries(chartPointData);

            SetChartPointDataTestProperties(chartPointData);

            // Precondition
            AssertChartPointDataSeriesDefaultProperties(chartPointDataSeries);

            // Call
            chartPointDataSeries.Update();

            // Assert
            AssertChartPointDataSeriesTestProperties(chartPointDataSeries);
        }
Пример #5
0
        public void GivenChartPointDataSeries_WhenUpdatedAfterChartPointDataPointsChanged_ChartPointDataSeriesPointsChanged()
        {
            // Given
            var chartPointData = new ChartPointData("Test name")
            {
                Points = new[]
                {
                    new Point2D(1.1, 2.2)
                }
            };

            var chartPointDataSeries            = new ChartPointDataSeries(chartPointData);
            IEnumerable <DataPoint> drawnPoints = chartPointDataSeries.ItemsSource.Cast <DataPoint>();

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

            // Then
            CollectionAssert.AreNotEqual(drawnPoints, chartPointDataSeries.ItemsSource.Cast <DataPoint>());
        }