public void CreateRows_StackChartDataNull_ThrowArgumentNullException() { // Call TestDelegate test = () => RiskeerStackChartDataFactory.CreateRows(Enumerable.Empty <IllustrationPointControlItem>(), null); // Assert var exception = Assert.Throws <ArgumentNullException>(test); Assert.AreEqual("stackChartData", exception.ParamName); }
public void CreateRows_IllustrationPointControlItemsNull_ThrowArgumentNullException() { // Call TestDelegate test = () => RiskeerStackChartDataFactory.CreateRows(null, new StackChartData()); // Assert var exception = Assert.Throws <ArgumentNullException>(test); Assert.AreEqual("illustrationPointControlItems", exception.ParamName); }
private void SetChartData() { RiskeerStackChartDataFactory.CreateColumns(data, chartData); RiskeerStackChartDataFactory.CreateRows(data, chartData); }
public void CreateRows_WithAllData_RowsAddedToStackChartData() { var stackChartData = new StackChartData(); const string windDirectionName = "SSE"; const string closingSituation = "Regular"; var beta = (RoundedDouble)3.14; var controlItems = new[] { new IllustrationPointControlItem(new TestTopLevelIllustrationPoint(), windDirectionName, closingSituation, new[] { new TestSubMechanismIllustrationPointStochast("Stochast 1", -0.9), new TestSubMechanismIllustrationPointStochast("Stochast 2", -0.43589), new TestSubMechanismIllustrationPointStochast("Stochast 3", -0.01), new TestSubMechanismIllustrationPointStochast("Stochast 4", -0.01), new TestSubMechanismIllustrationPointStochast("Stochast 5", -0.099) }, beta), new IllustrationPointControlItem(new TestTopLevelIllustrationPoint(), windDirectionName, closingSituation, new[] { new TestSubMechanismIllustrationPointStochast("Stochast 1", -0.43589), new TestSubMechanismIllustrationPointStochast("Stochast 2", -0.9), new TestSubMechanismIllustrationPointStochast("Stochast 3", -0.02), new TestSubMechanismIllustrationPointStochast("Stochast 4", -0.02), new TestSubMechanismIllustrationPointStochast("Stochast 5", -0.9) }, beta), new IllustrationPointControlItem(new TestTopLevelIllustrationPoint(), windDirectionName, closingSituation, new[] { new TestSubMechanismIllustrationPointStochast("Stochast 1", -0.43589), new TestSubMechanismIllustrationPointStochast("Stochast 2", -0.9), new TestSubMechanismIllustrationPointStochast("Stochast 3", -0.03), new TestSubMechanismIllustrationPointStochast("Stochast 4", -0.03), new TestSubMechanismIllustrationPointStochast("Stochast 5", -0.099) }, beta) }; RiskeerStackChartDataFactory.CreateColumns(controlItems, stackChartData); // Call RiskeerStackChartDataFactory.CreateRows(controlItems, stackChartData); // Assert RowChartData[] rows = stackChartData.Rows.ToArray(); Assert.AreEqual(4, rows.Length); Assert.AreEqual("Stochast 1", rows[0].Name); CollectionAssert.AreEqual(new[] { 0.81, 0.19, 0.19 }, rows[0].Values, new DoubleWithToleranceComparer(1e-6)); Assert.IsNull(rows[0].Color); Assert.AreEqual("Stochast 2", rows[1].Name); CollectionAssert.AreEqual(new[] { 0.19, 0.81, 0.81 }, rows[1].Values, new DoubleWithToleranceComparer(1e-6)); Assert.IsNull(rows[1].Color); Assert.AreEqual("Stochast 5", rows[2].Name); CollectionAssert.AreEqual(new[] { 0.00980, 0.81, 0.00980 }, rows[2].Values, new DoubleWithToleranceComparer(1e-6)); Assert.IsNull(rows[2].Color); Assert.AreEqual("Overig", rows[3].Name); CollectionAssert.AreEqual(new[] { 0.0002, 0.0008, 0.0018 }, rows[3].Values, new DoubleWithToleranceComparer(1e-6)); Assert.AreEqual(Color.Gray, rows[3].Color); }