Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssemblyResultPerSectionViewTest.cs =================================================================== diff -u -ra8237d30c7cb1cae20b2530f0f7c67ae60669d4b -r9bee399acaa46276771cd1d8988ec978274c3a85 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssemblyResultPerSectionViewTest.cs (.../AssemblyResultPerSectionViewTest.cs) (revision a8237d30c7cb1cae20b2530f0f7c67ae60669d4b) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssemblyResultPerSectionViewTest.cs (.../AssemblyResultPerSectionViewTest.cs) (revision 9bee399acaa46276771cd1d8988ec978274c3a85) @@ -30,9 +30,7 @@ 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; @@ -226,7 +224,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) using (AssemblyResultPerSectionView view = ShowAssemblyResultPerSectionView(assessmentSection)) { - assessmentSection.NotifyObservers(); + view.AssessmentSection.NotifyObservers(); // Precondition ButtonTester buttonTester = GetRefreshAssemblyResultButtonTester(); @@ -262,7 +260,7 @@ Assert.IsEmpty(warningProvider.GetError(button)); // When - assessmentSection.NotifyObservers(); + view.AssessmentSection.NotifyObservers(); // Then Assert.IsTrue(buttonTester.Properties.Enabled); @@ -275,8 +273,7 @@ { // Given var random = new Random(21); - var assessmentSection = TestDataGenerator.GetAssessmensectionWithAllFailureMechanismSectionsAndResults( - random.NextEnumValue()); + var assessmentSection = new AssessmentSection(random.NextEnumValue()); using (new AssemblyToolCalculatorFactoryConfig()) using (AssemblyResultPerSectionView view = ShowAssemblyResultPerSectionView(assessmentSection)) @@ -289,8 +286,8 @@ Assert.IsEmpty(warningProvider.GetError(button)); // When - IFailureMechanism[] failureMechanisms = assessmentSection.GetFailureMechanisms().ToArray(); - failureMechanisms[random.Next(failureMechanisms.Length)].NotifyObservers(); + IEnumerable failureMechanisms = assessmentSection.GetFailureMechanisms(); + failureMechanisms.ElementAt(random.Next(failureMechanisms.Count())).NotifyObservers(); // Then Assert.IsTrue(buttonTester.Properties.Enabled); @@ -326,42 +323,6 @@ } } - [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);