Ejemplo n.º 1
0
        public void ConvertSeriesData_DataNull_ThrowsArgumentNullException()
        {
            // Call
            TestDelegate test = () => RowChartDataConverter.ConvertSeriesData(null, new ColumnSeries());

            // Assert
            const string expectedMessage = "Null data cannot be converted into series data.";
            var          exception       = TestHelper.AssertThrowsArgumentExceptionAndTestMessage <ArgumentNullException>(test, expectedMessage);

            Assert.AreEqual("data", exception.ParamName);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a new instance of <see cref="RowChartDataSeries"/>.
        /// </summary>
        /// <param name="rowChartData">The <see cref="RowChartData"/> which the series is based upon.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="rowChartData"/> is <c>null</c>.</exception>
        public RowChartDataSeries(RowChartData rowChartData)
        {
            if (rowChartData == null)
            {
                throw new ArgumentNullException(nameof(rowChartData));
            }

            IsStacked       = true;
            StrokeThickness = 1;

            RowChartDataConverter.ConvertSeriesData(rowChartData, this);
            RowChartDataConverter.ConvertSeriesProperties(rowChartData, this);
        }
Ejemplo n.º 3
0
        public void ConvertSeriesData_SeriesNull_ThrowsArgumentNullException()
        {
            // Setup
            var rowData = new RowChartData("data", new double[0], null);

            // Call
            TestDelegate test = () => RowChartDataConverter.ConvertSeriesData(rowData, null);

            // Assert
            const string expectedMessage = "Null data cannot be used as conversion target.";
            var          exception       = TestHelper.AssertThrowsArgumentExceptionAndTestMessage <ArgumentNullException>(test, expectedMessage);

            Assert.AreEqual("series", exception.ParamName);
        }
Ejemplo n.º 4
0
        public void ConvertSeriesData_DataWithValues_ColumnItemsAddedToSeries()
        {
            // Setup
            var values = new[]
            {
                0.2,
                0.7,
                0.1
            };

            var rowData = new RowChartData("data", values, null);
            var series  = new ColumnSeries();

            // Call
            RowChartDataConverter.ConvertSeriesData(rowData, series);

            // Assert
            CollectionAssert.AreEqual(values, series.Items.Select(i => i.Value));
        }