Ejemplo n.º 1
0
        public void ConvertSeriesProperties_DataNull_ThrowsArgumentNullException()
        {
            // Call
            TestDelegate test = () => RowChartDataConverter.ConvertSeriesProperties(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 ConvertSeriesProperties_SeriesNull_ThrowsArgumentNullException()
        {
            // Setup
            var rowData = new RowChartData("data", new double[0], null);

            // Call
            TestDelegate test = () => RowChartDataConverter.ConvertSeriesProperties(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 ConvertSeriesProperties_WithData_SetPropertiesOfSeries(bool withColor)
        {
            // Setup
            const string name  = "data";
            Color?       color = withColor
                               ? (Color?)Color.Red
                               : null;

            var rowData = new RowChartData(name, new double[0], color);
            var series  = new ColumnSeries();

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

            // Assert
            Assert.AreEqual(name, series.Title);

            OxyColor actualColor = withColor
                                       ? OxyColor.FromArgb(color.Value.A, color.Value.R, color.Value.G, color.Value.B)
                                       : OxyColors.Automatic;

            Assert.AreEqual(actualColor, series.FillColor);
        }