Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/MacrostabilityOutwardsResultViewTest.cs =================================================================== diff -u -re5b6ddb7a02c006c9bb38838ac95627b6346571a -ra07327b1e6f53a7628c2bf145b0356ae43d39ba8 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/MacrostabilityOutwardsResultViewTest.cs (.../MacrostabilityOutwardsResultViewTest.cs) (revision e5b6ddb7a02c006c9bb38838ac95627b6346571a) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/MacrostabilityOutwardsResultViewTest.cs (.../MacrostabilityOutwardsResultViewTest.cs) (revision a07327b1e6f53a7628c2bf145b0356ae43d39ba8) @@ -22,16 +22,11 @@ using System; using System.Windows.Forms; using Core.Common.Base; -using Core.Common.TestUtil; using NUnit.Extensions.Forms; using NUnit.Framework; using Rhino.Mocks; -using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators; using Ringtoets.Common.Data.AssessmentSection; -using Ringtoets.Common.Data.TestUtil; -using Ringtoets.Common.Forms.Helpers; using Ringtoets.Common.Forms.Views; -using Ringtoets.Common.Primitives; using Ringtoets.Integration.Data.StandAlone; using Ringtoets.Integration.Data.StandAlone.SectionResults; using Ringtoets.Integration.Forms.Views.SectionResultRows; @@ -144,267 +139,5 @@ mocks.VerifyAll(); } } - - [Test] - public void FailureMechanismResultView_FailureMechanismSectionResultAssigned_SectionAddedAsRow() - { - // Setup - var failureMechanism = new MacroStabilityOutwardsFailureMechanism(); - - var mocks = new MockRepository(); - IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks); - mocks.ReplayAll(); - - var random = new Random(21); - var result = new MacroStabilityOutwardsFailureMechanismSectionResult( - FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 1")) - { - SimpleAssessmentResult = SimpleAssessmentResultType.None, - DetailedAssessmentProbability = random.NextDouble(), - TailorMadeAssessmentProbability = random.NextDouble() - }; - var sectionResults = new ObservableList - { - result - }; - - // Call - using (var form = new Form()) - using (new AssemblyToolCalculatorFactoryConfig()) - using (var view = new MacroStabilityOutwardsResultView(sectionResults, failureMechanism, assessmentSection)) - { - form.Controls.Add(view); - form.Show(); - - // Assert - var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; - DataGridViewRowCollection rows = dataGridView.Rows; - Assert.AreEqual(1, rows.Count); - - DataGridViewRow dataGridViewRow = rows[0]; - var rowObject = (MacroStabilityOutwardsSectionResultRow) dataGridViewRow.DataBoundItem; - DataGridViewCellCollection cells = dataGridViewRow.Cells; - - Assert.AreEqual(columnCount, cells.Count); - Assert.AreEqual("Section 1", cells[nameColumnIndex].FormattedValue); - - Assert.AreEqual(result.SimpleAssessmentResult, cells[simpleAssessmentResultIndex].Value); - Assert.AreEqual(result.DetailedAssessmentResult, cells[detailedAssessmentResultIndex].Value); - string expectedDetailedAssessmentProbabilityString = ProbabilityFormattingHelper.Format(result.DetailedAssessmentProbability); - Assert.AreEqual(expectedDetailedAssessmentProbabilityString, cells[detailedAssessmentProbabilityIndex].FormattedValue); - Assert.AreEqual(result.TailorMadeAssessmentResult, cells[tailorMadeAssessmentResultIndex].Value); - string expectedTailorMadeAssessmentProbabilityString = ProbabilityFormattingHelper.Format(result.TailorMadeAssessmentProbability); - Assert.AreEqual(expectedTailorMadeAssessmentProbabilityString, cells[tailorMadeAssessmentProbabilityIndex].FormattedValue); - - Assert.AreEqual(rowObject.SimpleAssemblyCategoryGroup, cells[simpleAssemblyCategoryGroupIndex].Value); - Assert.AreEqual(rowObject.DetailedAssemblyCategoryGroup, cells[detailedAssemblyCategoryGroupIndex].Value); - Assert.AreEqual(rowObject.TailorMadeAssemblyCategoryGroup, cells[tailorMadeAssemblyCategoryGroupIndex].Value); - Assert.AreEqual(rowObject.CombinedAssemblyCategoryGroup, cells[combinedAssemblyCategoryGroupIndex].Value); - Assert.AreEqual(rowObject.UseManualAssemblyCategoryGroup, cells[useManualAssemblyCategoryGroupIndex].Value); - Assert.AreEqual(rowObject.ManualAssemblyCategoryGroup, cells[manualAssemblyCategoryGroupIndex].Value); - mocks.VerifyAll(); - } - } - - [Test] - [TestCase(SimpleAssessmentResultType.None, true)] - [TestCase(SimpleAssessmentResultType.AssessFurther, true)] - [TestCase(SimpleAssessmentResultType.NotApplicable, false)] - [TestCase(SimpleAssessmentResultType.ProbabilityNegligible, false)] - public void FailureMechanismResultView_SimpleAssessmentResultSet_CellsDisabledEnabled( - SimpleAssessmentResultType simpleAssessmentResult, - bool cellsEnabled) - { - // Setup - var failureMechanism = new MacroStabilityOutwardsFailureMechanism(); - - var mocks = new MockRepository(); - IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks); - mocks.ReplayAll(); - - var result = new MacroStabilityOutwardsFailureMechanismSectionResult( - FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) - { - SimpleAssessmentResult = simpleAssessmentResult, - TailorMadeAssessmentResult = TailorMadeAssessmentProbabilityAndDetailedCalculationResultType.Probability - }; - var sectionResults = new ObservableList - { - result - }; - - // Call - using (var form = new Form()) - using (new AssemblyToolCalculatorFactoryConfig()) - using (var view = new MacroStabilityOutwardsResultView(sectionResults, failureMechanism, assessmentSection)) - { - form.Controls.Add(view); - form.Show(); - - var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; - DataGridViewCellCollection cells = dataGridView.Rows[0].Cells; - - // Assert - DataGridViewTestHelper.AssertCellsState(cells, new[] - { - detailedAssessmentResultIndex, - detailedAssessmentProbabilityIndex, - tailorMadeAssessmentResultIndex, - tailorMadeAssessmentProbabilityIndex - }, cellsEnabled); - mocks.VerifyAll(); - } - } - - [Test] - [TestCase(DetailedAssessmentResultType.NotAssessed, false)] - [TestCase(DetailedAssessmentResultType.Probability, true)] - public void FailureMechanismResultView_DetailedAssessmentResultSet_CellDisabledEnabled( - DetailedAssessmentResultType detailedAssessmentResult, - bool cellEnabled) - { - // Setup - var failureMechanism = new MacroStabilityOutwardsFailureMechanism(); - - var mocks = new MockRepository(); - IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks); - mocks.ReplayAll(); - - var result = new MacroStabilityOutwardsFailureMechanismSectionResult( - FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) - { - DetailedAssessmentResult = detailedAssessmentResult - }; - var sectionResults = new ObservableList - { - result - }; - - // Call - using (var form = new Form()) - using (new AssemblyToolCalculatorFactoryConfig()) - using (var view = new MacroStabilityOutwardsResultView(sectionResults, failureMechanism, assessmentSection)) - { - form.Controls.Add(view); - form.Show(); - - var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; - DataGridViewCellCollection cells = dataGridView.Rows[0].Cells; - - // Assert - DataGridViewTestHelper.AssertCellsState(cells, new[] - { - detailedAssessmentProbabilityIndex - }, cellEnabled); - mocks.VerifyAll(); - } - } - - [Test] - [TestCase(TailorMadeAssessmentProbabilityAndDetailedCalculationResultType.NotAssessed, false)] - [TestCase(TailorMadeAssessmentProbabilityAndDetailedCalculationResultType.Insufficient, false)] - [TestCase(TailorMadeAssessmentProbabilityAndDetailedCalculationResultType.None, false)] - [TestCase(TailorMadeAssessmentProbabilityAndDetailedCalculationResultType.Sufficient, false)] - [TestCase(TailorMadeAssessmentProbabilityAndDetailedCalculationResultType.Probability, true)] - public void FailureMechanismResultView_TailorMadeAssessmentResultSet_CellDisabledEnabled( - TailorMadeAssessmentProbabilityAndDetailedCalculationResultType tailorMadeAssessmentResult, - bool cellEnabled) - { - // Setup - var failureMechanism = new MacroStabilityOutwardsFailureMechanism(); - - var mocks = new MockRepository(); - IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks); - mocks.ReplayAll(); - - var result = new MacroStabilityOutwardsFailureMechanismSectionResult( - FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) - { - TailorMadeAssessmentResult = tailorMadeAssessmentResult - }; - var sectionResults = new ObservableList - { - result - }; - - // Call - using (var form = new Form()) - using (new AssemblyToolCalculatorFactoryConfig()) - using (var view = new MacroStabilityOutwardsResultView(sectionResults, failureMechanism, assessmentSection)) - { - form.Controls.Add(view); - form.Show(); - - var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; - DataGridViewCellCollection cells = dataGridView.Rows[0].Cells; - - // Assert - DataGridViewTestHelper.AssertCellsState(cells, new[] - { - tailorMadeAssessmentProbabilityIndex - }, cellEnabled); - mocks.VerifyAll(); - } - } - - [Test] - [TestCase(true)] - [TestCase(false)] - public void FailureMechanismResultView_UseManualAssemblyCategoryGroupSet_CellDisabledEnabled(bool useManualAssemblyCategoryGroup) - { - // Setup - var failureMechanism = new MacroStabilityOutwardsFailureMechanism(); - - var mocks = new MockRepository(); - IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks); - mocks.ReplayAll(); - - var result = new MacroStabilityOutwardsFailureMechanismSectionResult( - FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) - { - TailorMadeAssessmentResult = TailorMadeAssessmentProbabilityAndDetailedCalculationResultType.Probability, - UseManualAssemblyCategoryGroup = useManualAssemblyCategoryGroup - }; - var sectionResults = new ObservableList - { - result - }; - - // Call - using (var form = new Form()) - using (new AssemblyToolCalculatorFactoryConfig()) - using (var view = new MacroStabilityOutwardsResultView(sectionResults, failureMechanism, assessmentSection)) - { - form.Controls.Add(view); - form.Show(); - - var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; - DataGridViewCellCollection cells = dataGridView.Rows[0].Cells; - - // Assert - DataGridViewTestHelper.AssertCellsState(cells, new[] - { - manualAssemblyCategoryGroupIndex - }, useManualAssemblyCategoryGroup); - - DataGridViewTestHelper.AssertCellsState(cells, new[] - { - simpleAssessmentResultIndex, - detailedAssessmentResultIndex, - detailedAssessmentProbabilityIndex, - tailorMadeAssessmentResultIndex, - tailorMadeAssessmentProbabilityIndex - }, !useManualAssemblyCategoryGroup); - - DataGridViewTestHelper.AssertCellsState(cells, new[] - { - simpleAssemblyCategoryGroupIndex, - detailedAssemblyCategoryGroupIndex, - tailorMadeAssemblyCategoryGroupIndex, - combinedAssemblyCategoryGroupIndex - }, !useManualAssemblyCategoryGroup, true); - mocks.VerifyAll(); - } - } } } \ No newline at end of file