Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssemblyResultPerSectionView.Designer.cs =================================================================== diff -u -r48244f68eee25ef1d91701d82e4c4867f0252ffc -rae5032e5256eb01f3fd7d2eb2061a0ae2ffae946 --- Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssemblyResultPerSectionView.Designer.cs (.../AssemblyResultPerSectionView.Designer.cs) (revision 48244f68eee25ef1d91701d82e4c4867f0252ffc) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssemblyResultPerSectionView.Designer.cs (.../AssemblyResultPerSectionView.Designer.cs) (revision ae5032e5256eb01f3fd7d2eb2061a0ae2ffae946) @@ -42,11 +42,9 @@ this.buttonGroupBox = new System.Windows.Forms.GroupBox(); this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components); this.warningProvider = new System.Windows.Forms.ErrorProvider(this.components); - this.manualAssemblyWarningProvider = new System.Windows.Forms.ErrorProvider(this.components); this.buttonGroupBox.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.warningProvider)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.manualAssemblyWarningProvider)).BeginInit(); this.SuspendLayout(); // // dataGridViewControl @@ -96,13 +94,6 @@ this.warningProvider.Icon = Core.Gui.Properties.Resources.warning; this.warningProvider.SetIconPadding(this.refreshAssemblyResultsButton, 4); // - // manualAssemblyWarningProvider - // - this.manualAssemblyWarningProvider.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.NeverBlink; - this.manualAssemblyWarningProvider.ContainerControl = this; - this.manualAssemblyWarningProvider.Icon = global::Riskeer.Common.Forms.Properties.Resources.PencilWarning; - this.manualAssemblyWarningProvider.SetIconPadding(this.refreshAssemblyResultsButton, 4); - // // AssemblyResultPerSectionView // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -116,7 +107,6 @@ this.buttonGroupBox.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.warningProvider)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.manualAssemblyWarningProvider)).EndInit(); this.ResumeLayout(false); } @@ -128,6 +118,5 @@ private System.Windows.Forms.GroupBox buttonGroupBox; private System.Windows.Forms.ErrorProvider errorProvider; private System.Windows.Forms.ErrorProvider warningProvider; - private System.Windows.Forms.ErrorProvider manualAssemblyWarningProvider; } } Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssemblyResultPerSectionView.cs =================================================================== diff -u -r520b3153840dada327c8bd936a4d6a7a07427331 -rae5032e5256eb01f3fd7d2eb2061a0ae2ffae946 --- Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssemblyResultPerSectionView.cs (.../AssemblyResultPerSectionView.cs) (revision 520b3153840dada327c8bd936a4d6a7a07427331) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssemblyResultPerSectionView.cs (.../AssemblyResultPerSectionView.cs) (revision ae5032e5256eb01f3fd7d2eb2061a0ae2ffae946) @@ -87,7 +87,6 @@ base.OnLoad(e); InitializeDataGridView(); - CheckManualAssemblyResults(); dataGridViewControl.CellFormatting += HandleCellStyling; } @@ -114,44 +113,9 @@ warningProvider.SetIconPadding(refreshAssemblyResultsButton, string.IsNullOrEmpty(errorProvider.GetError(refreshAssemblyResultsButton)) ? 4 : 24); - CheckManualAssemblyResults(); } } - private void CheckManualAssemblyResults() - { - SetManualAssemblyWarningIconPadding(); - - if (AssessmentSectionHelper.HasManualAssemblyResults(AssessmentSection)) - { - manualAssemblyWarningProvider.SetError(refreshAssemblyResultsButton, - RiskeerCommonFormsResources.ManualAssemblyWarning_FailureMechanismAssemblyResult_is_based_on_manual_assemblies); - } - } - - private void SetManualAssemblyWarningIconPadding() - { - bool hasError = !string.IsNullOrEmpty(errorProvider.GetError(refreshAssemblyResultsButton)); - bool hasWarning = !string.IsNullOrEmpty(warningProvider.GetError(refreshAssemblyResultsButton)); - - int manualAssemblyWarningPadding; - if (hasError && hasWarning) - { - manualAssemblyWarningPadding = 44; - } - else if (hasError || hasWarning) - { - manualAssemblyWarningPadding = 24; - } - else - { - manualAssemblyWarningPadding = 4; - } - - manualAssemblyWarningProvider.SetIconPadding(refreshAssemblyResultsButton, - manualAssemblyWarningPadding); - } - private void HandleCellStyling(object sender, DataGridViewCellFormattingEventArgs e) { dataGridViewControl.FormatCellWithColumnStateDefinition(e.RowIndex, e.ColumnIndex); @@ -245,15 +209,12 @@ { errorProvider.SetError(refreshAssemblyResultsButton, e.Message); } - - CheckManualAssemblyResults(); } private void ClearCurrentData() { errorProvider.SetError(refreshAssemblyResultsButton, string.Empty); warningProvider.SetError(refreshAssemblyResultsButton, string.Empty); - manualAssemblyWarningProvider.SetError(refreshAssemblyResultsButton, string.Empty); dataGridViewControl.SetDataSource(Enumerable.Empty()); } } Index: Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/AssemblyResultPerSectionViewTest.cs =================================================================== diff -u -r411152ca8360a1f0b6ea680314f5771ac4792dc9 -rae5032e5256eb01f3fd7d2eb2061a0ae2ffae946 --- Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/AssemblyResultPerSectionViewTest.cs (.../AssemblyResultPerSectionViewTest.cs) (revision 411152ca8360a1f0b6ea680314f5771ac4792dc9) +++ Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/AssemblyResultPerSectionViewTest.cs (.../AssemblyResultPerSectionViewTest.cs) (revision ae5032e5256eb01f3fd7d2eb2061a0ae2ffae946) @@ -35,13 +35,10 @@ using Riskeer.AssemblyTool.KernelWrapper.TestUtil.Calculators.Assembly; using Riskeer.Common.Data.AssessmentSection; using Riskeer.Common.Data.FailureMechanism; -using Riskeer.Common.Data.TestUtil; using Riskeer.HeightStructures.Data.TestUtil; using Riskeer.Integration.Data; using Riskeer.Integration.Forms.Views; using Riskeer.Integration.TestUtil; -using Riskeer.MacroStabilityInwards.Data; -using Riskeer.Piping.Data; using CoreGuiResources = Core.Gui.Properties.Resources; using RiskeerCommonFormsResources = Riskeer.Common.Forms.Properties.Resources; @@ -71,7 +68,6 @@ private const int duneErosionColumnIndex = 18; private const int expectedColumnCount = 19; private const string assemblyResultOutdatedWarning = "Toetsoordeel is verouderd. Druk op de \"Toetsoordeel verversen\" knop om opnieuw te berekenen."; - private const string assemblyResultManualWarning = "Toetsoordeel is (deels) gebaseerd op handmatig overschreven toetsoordelen."; private Form testForm; @@ -115,7 +111,7 @@ new Random(21).NextEnumValue()); // Call - using (new AssemblyToolCalculatorFactoryConfigOld()) + using (new AssemblyToolCalculatorFactoryConfig()) using (var view = new AssemblyResultPerSectionView(assessmentSection)) { testForm.Controls.Add(view); @@ -152,7 +148,7 @@ public void GivenFormWithAssemblyResultPerSectionView_ThenExpectedColumnsAreVisible() { // Given - using (new AssemblyToolCalculatorFactoryConfigOld()) + using (new AssemblyToolCalculatorFactoryConfig()) using (ShowAssemblyResultPerSectionView()) { // Then @@ -187,7 +183,7 @@ public void Constructor_AssessmentSectionWithReferenceLine_ExpectedValues() { // Call - using (new AssemblyToolCalculatorFactoryConfigOld()) + using (new AssemblyToolCalculatorFactoryConfig()) using (ShowAssemblyResultPerSectionView()) { DataGridView dataGridView = GetDataGridView(); @@ -221,7 +217,7 @@ bool readOnly, string errorText, CellStyle style) { // Given - using (new AssemblyToolCalculatorFactoryConfigOld()) + using (new AssemblyToolCalculatorFactoryConfig()) using (ShowAssemblyResultPerSectionView()) { ButtonTester buttonTester = GetRefreshAssemblyResultButtonTester(); @@ -256,7 +252,7 @@ AssessmentSection assessmentSection = TestDataGenerator.GetAssessmentSectionWithAllFailureMechanismSectionsAndResults( new Random(21).NextEnumValue()); - using (new AssemblyToolCalculatorFactoryConfigOld()) + using (new AssemblyToolCalculatorFactoryConfig()) using (AssemblyResultPerSectionView view = ShowAssemblyResultPerSectionView(assessmentSection)) { assessmentSection.NotifyObservers(); @@ -284,7 +280,7 @@ AssessmentSection assessmentSection = TestDataGenerator.GetAssessmentSectionWithAllFailureMechanismSectionsAndResults( new Random(21).NextEnumValue()); - using (new AssemblyToolCalculatorFactoryConfigOld()) + using (new AssemblyToolCalculatorFactoryConfig()) using (AssemblyResultPerSectionView view = ShowAssemblyResultPerSectionView(assessmentSection)) { // Precondition @@ -311,7 +307,7 @@ AssessmentSection assessmentSection = TestDataGenerator.GetAssessmentSectionWithAllFailureMechanismSectionsAndResults( random.NextEnumValue()); - using (new AssemblyToolCalculatorFactoryConfigOld()) + using (new AssemblyToolCalculatorFactoryConfig()) using (AssemblyResultPerSectionView view = ShowAssemblyResultPerSectionView(assessmentSection)) { // Precondition @@ -340,7 +336,7 @@ var calculation = new TestHeightStructuresCalculationScenario(); assessmentSection.HeightStructures.CalculationsGroup.Children.Add(calculation); - using (new AssemblyToolCalculatorFactoryConfigOld()) + using (new AssemblyToolCalculatorFactoryConfig()) using (AssemblyResultPerSectionView view = ShowAssemblyResultPerSectionView(assessmentSection)) { // Precondition @@ -368,10 +364,10 @@ AssessmentSection assessmentSection = TestDataGenerator.GetAssessmentSectionWithAllFailureMechanismSectionsAndResults( new Random(21).NextEnumValue()); - using (new AssemblyToolCalculatorFactoryConfigOld()) + using (new AssemblyToolCalculatorFactoryConfig()) { - var calculatorFactory = (TestAssemblyToolCalculatorFactoryOld) AssemblyToolCalculatorFactoryOld.Instance; - AssessmentSectionAssemblyCalculatorStubOld calculator = calculatorFactory.LastCreatedAssessmentSectionAssemblyCalculator; + var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; + AssessmentSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedAssessmentSectionAssemblyCalculator; calculator.ThrowExceptionOnCalculate = withError; using (AssemblyResultPerSectionView view = ShowAssemblyResultPerSectionView(assessmentSection)) @@ -395,153 +391,6 @@ } } - [Test] - public void GivenFormWithAssemblyResultPerSectionViewAndManualAssembly_WhenShown_ThenManualAssemblyUsed() - { - // Given - var random = new Random(21); - AssessmentSection assessmentSection = TestDataGenerator.GetAssessmentSectionWithAllFailureMechanismSectionsAndResults( - random.NextEnumValue()); - MacroStabilityInwardsFailureMechanismSectionResultOld sectionResult = assessmentSection.MacroStabilityInwards.SectionResultsOld.First(); - sectionResult.UseManualAssembly = true; - sectionResult.ManualAssemblyProbability = random.NextDouble(); - - using (new AssemblyToolCalculatorFactoryConfigOld()) - { - var calculatorFactory = (TestAssemblyToolCalculatorFactoryOld) AssemblyToolCalculatorFactoryOld.Instance; - FailureMechanismSectionAssemblyCalculatorOldStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator; - - // When - using (ShowAssemblyResultPerSectionView(assessmentSection)) - { - // Then - Assert.AreEqual(sectionResult.ManualAssemblyProbability, calculator.ManualAssemblyProbabilityInput); - } - } - } - - [Test] - [TestCase(true)] - [TestCase(false)] - public void GivenFormWithAssemblyResultPerSectionViewWithManualAssembly_ThenExpectedWarningSet(bool hasManualAssembly) - { - // Given - var assessmentSection = new AssessmentSection(new Random(21).NextEnumValue()); - PipingFailureMechanism failureMechanism = assessmentSection.Piping; - FailureMechanismTestHelper.AddSections(failureMechanism, 1); - failureMechanism.SectionResultsOld.Single().UseManualAssembly = hasManualAssembly; - - // When - using (AssemblyResultPerSectionView view = ShowAssemblyResultPerSectionView(assessmentSection)) - { - // Then - ButtonTester buttonTester = GetRefreshAssemblyResultButtonTester(); - Button button = buttonTester.Properties; - ErrorProvider manualAssemblyWarningProvider = GetManualAssemblyWarningProvider(view); - Assert.AreEqual(hasManualAssembly ? assemblyResultManualWarning : string.Empty, manualAssemblyWarningProvider.GetError(button)); - } - } - - [Test] - [TestCase(true)] - [TestCase(false)] - public void GivenFormWithAssemblyResultPerSectionViewWithManualAssembly_WhenAssessmentSectionNotifiesObservers_ThenWarningsSet( - bool hasManualAssembly) - { - // Given - var assessmentSection = new AssessmentSection(new Random(21).NextEnumValue()); - ReferenceLineTestFactory.SetReferenceLineGeometry(assessmentSection.ReferenceLine); - foreach (IHasSectionResults failureMechanism in assessmentSection.GetFailureMechanisms() - .Cast>()) - { - FailureMechanismTestHelper.AddSectionsBasedOnReferenceLine(assessmentSection.ReferenceLine, failureMechanism, 1); - failureMechanism.SectionResultsOld.Single().UseManualAssembly = hasManualAssembly; - } - - using (AssemblyResultPerSectionView view = ShowAssemblyResultPerSectionView(assessmentSection)) - { - // Precondition - ButtonTester buttonTester = GetRefreshAssemblyResultButtonTester(); - Button button = buttonTester.Properties; - Assert.IsFalse(button.Enabled); - ErrorProvider warningProvider = GetWarningProvider(view); - Assert.IsEmpty(warningProvider.GetError(button)); - ErrorProvider manualAssemblyWarningProvider = GetManualAssemblyWarningProvider(view); - string expectedManualAssemblyWarning = hasManualAssembly ? assemblyResultManualWarning : string.Empty; - Assert.AreEqual(4, manualAssemblyWarningProvider.GetIconPadding(button)); - Assert.AreEqual(expectedManualAssemblyWarning, manualAssemblyWarningProvider.GetError(button)); - - // When - assessmentSection.NotifyObservers(); - - // Then - Assert.AreEqual(assemblyResultOutdatedWarning, warningProvider.GetError(button)); - Assert.AreEqual(expectedManualAssemblyWarning, manualAssemblyWarningProvider.GetError(button)); - Assert.AreEqual(24, manualAssemblyWarningProvider.GetIconPadding(button)); - } - } - - [Test] - public void GivenAssessmentSectionObserversNotified_WhenRefreshingAssemblyResults_ThenWarningPaddingSet() - { - // Given - using (new AssemblyToolCalculatorFactoryConfigOld()) - using (AssemblyResultPerSectionView view = ShowAssemblyResultPerSectionView()) - { - AssessmentSection assessmentSection = view.AssessmentSection; - PipingFailureMechanism failureMechanism = assessmentSection.Piping; - FailureMechanismTestHelper.AddSections(failureMechanism, 1); - failureMechanism.SectionResultsOld.Single().UseManualAssembly = true; - assessmentSection.NotifyObservers(); - - // Precondition - ButtonTester buttonTester = GetRefreshAssemblyResultButtonTester(); - Button button = buttonTester.Properties; - ErrorProvider manualAssemblyWarningProvider = GetManualAssemblyWarningProvider(view); - Assert.AreEqual(24, manualAssemblyWarningProvider.GetIconPadding(button)); - - // When - buttonTester.Click(); - - // Then - Assert.AreEqual(4, manualAssemblyWarningProvider.GetIconPadding(button)); - Assert.AreEqual(assemblyResultManualWarning, manualAssemblyWarningProvider.GetError(button)); - } - } - - [Test] - public void GivenAssemblyResultPerSectionViewWithError_WhenNotified_ThenWarningAndPaddingSet() - { - // Given - using (new AssemblyToolCalculatorFactoryConfigOld()) - { - var calculatorFactory = (TestAssemblyToolCalculatorFactoryOld) AssemblyToolCalculatorFactoryOld.Instance; - AssessmentSectionAssemblyCalculatorStubOld calculator = calculatorFactory.LastCreatedAssessmentSectionAssemblyCalculator; - calculator.ThrowExceptionOnCalculate = true; - - using (AssemblyResultPerSectionView view = ShowAssemblyResultPerSectionView()) - { - AssessmentSection assessmentSection = view.AssessmentSection; - PipingFailureMechanism failureMechanism = assessmentSection.Piping; - FailureMechanismTestHelper.AddSections(failureMechanism, 1); - failureMechanism.SectionResultsOld.Single().UseManualAssembly = true; - - // Precondition - ButtonTester buttonTester = GetRefreshAssemblyResultButtonTester(); - Button button = buttonTester.Properties; - ErrorProvider manualAssemblyWarningProvider = GetManualAssemblyWarningProvider(view); - Assert.AreEqual(24, manualAssemblyWarningProvider.GetIconPadding(button)); - - // When - assessmentSection.NotifyObservers(); - - // Then - Assert.AreEqual(44, manualAssemblyWarningProvider.GetIconPadding(button)); - Assert.AreEqual(assemblyResultManualWarning, manualAssemblyWarningProvider.GetError(button)); - } - } - } - private ButtonTester GetRefreshAssemblyResultButtonTester() { return new ButtonTester("refreshAssemblyResultsButton", testForm); @@ -569,11 +418,6 @@ return TypeUtils.GetField(resultControl, "warningProvider"); } - private static ErrorProvider GetManualAssemblyWarningProvider(AssemblyResultPerSectionView resultControl) - { - return TypeUtils.GetField(resultControl, "manualAssemblyWarningProvider"); - } - private AssemblyResultPerSectionView ShowAssemblyResultPerSectionView() { return ShowAssemblyResultPerSectionView(TestDataGenerator.GetAssessmentSectionWithAllFailureMechanismSectionsAndResults(