Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyResultPerSectionView.cs =================================================================== diff -u -r28685210caaafd166b7d6a0f60a6e5fd91c22a30 -ra8237d30c7cb1cae20b2530f0f7c67ae60669d4b --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyResultPerSectionView.cs (.../AssemblyResultPerSectionView.cs) (revision 28685210caaafd166b7d6a0f60a6e5fd91c22a30) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyResultPerSectionView.cs (.../AssemblyResultPerSectionView.cs) (revision a8237d30c7cb1cae20b2530f0f7c67ae60669d4b) @@ -108,6 +108,9 @@ if (!RefreshAssemblyResultsButton.Enabled) { RefreshAssemblyResultsButton.Enabled = true; + warningProvider.SetIconPadding(RefreshAssemblyResultsButton, + errorProvider.GetError(RefreshAssemblyResultsButton) == string.Empty + ? 4 : 24); warningProvider.SetError(RefreshAssemblyResultsButton, Resources.AssemblyResultView_RefreshAssemblyResultsButton_Warning_Result_is_outdated_Press_Refresh_button_to_recalculate); } Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssemblyResultPerSectionViewTest.cs =================================================================== diff -u -r9bee399acaa46276771cd1d8988ec978274c3a85 -ra8237d30c7cb1cae20b2530f0f7c67ae60669d4b --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssemblyResultPerSectionViewTest.cs (.../AssemblyResultPerSectionViewTest.cs) (revision 9bee399acaa46276771cd1d8988ec978274c3a85) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssemblyResultPerSectionViewTest.cs (.../AssemblyResultPerSectionViewTest.cs) (revision a8237d30c7cb1cae20b2530f0f7c67ae60669d4b) @@ -30,7 +30,9 @@ using Core.Common.Util.Reflection; using NUnit.Extensions.Forms; using NUnit.Framework; +using Ringtoets.AssemblyTool.KernelWrapper.Calculators; using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators; +using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators.Assembly; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.HeightStructures.Data.TestUtil; @@ -224,7 +226,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) using (AssemblyResultPerSectionView view = ShowAssemblyResultPerSectionView(assessmentSection)) { - view.AssessmentSection.NotifyObservers(); + assessmentSection.NotifyObservers(); // Precondition ButtonTester buttonTester = GetRefreshAssemblyResultButtonTester(); @@ -260,7 +262,7 @@ Assert.IsEmpty(warningProvider.GetError(button)); // When - view.AssessmentSection.NotifyObservers(); + assessmentSection.NotifyObservers(); // Then Assert.IsTrue(buttonTester.Properties.Enabled); @@ -273,7 +275,8 @@ { // Given var random = new Random(21); - var assessmentSection = new AssessmentSection(random.NextEnumValue()); + var assessmentSection = TestDataGenerator.GetAssessmensectionWithAllFailureMechanismSectionsAndResults( + random.NextEnumValue()); using (new AssemblyToolCalculatorFactoryConfig()) using (AssemblyResultPerSectionView view = ShowAssemblyResultPerSectionView(assessmentSection)) @@ -286,8 +289,8 @@ Assert.IsEmpty(warningProvider.GetError(button)); // When - IEnumerable failureMechanisms = assessmentSection.GetFailureMechanisms(); - failureMechanisms.ElementAt(random.Next(failureMechanisms.Count())).NotifyObservers(); + IFailureMechanism[] failureMechanisms = assessmentSection.GetFailureMechanisms().ToArray(); + failureMechanisms[random.Next(failureMechanisms.Length)].NotifyObservers(); // Then Assert.IsTrue(buttonTester.Properties.Enabled); @@ -323,6 +326,42 @@ } } + [Test] + [TestCase(true, 24)] + [TestCase(false, 4)] + public void GivenFormWithAssemblyResultPerSectionView_WithOrWithoutErrorSetAndObserverNotified_ThenWarningSetWithPadding(bool withError, int expectedPadding) + { + // Given + AssessmentSection assessmentSection = TestDataGenerator.GetAssessmensectionWithAllFailureMechanismSectionsAndResults( + new Random(21).NextEnumValue()); + + using (new AssemblyToolCalculatorFactoryConfig()) + { + var calculatorfactory = (TestAssemblyToolCalculatorFactory )AssemblyToolCalculatorFactory.Instance; + AssessmentSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedAssessmentSectionAssemblyCalculator; + calculator.ThrowExceptionOnCalculate = withError; + + using (AssemblyResultPerSectionView view = ShowAssemblyResultPerSectionView(assessmentSection)) + { + // Precondition + ButtonTester buttonTester = GetRefreshAssemblyResultButtonTester(); + Button button = buttonTester.Properties; + Assert.IsFalse(button.Enabled); + ErrorProvider errorProvider = GetErrorProvider(view); + Assert.AreEqual(withError, !string.IsNullOrEmpty(errorProvider.GetError(button))); + ErrorProvider warningProvider = GetWarningProvider(view); + Assert.IsEmpty(warningProvider.GetError(button)); + + // When + assessmentSection.NotifyObservers(); + + // Then + Assert.AreEqual(assemblyResultOutdatedWarning, warningProvider.GetError(button)); + Assert.AreEqual(expectedPadding, warningProvider.GetIconPadding(button)); + } + } + } + private ButtonTester GetRefreshAssemblyResultButtonTester() { return new ButtonTester("RefreshAssemblyResultsButton", testForm);