Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Merge/AssessmentSectionMerger.cs =================================================================== diff -u -raa69c30a42cc90d74f4f219134a5af877dc4e857 -r7e75faf99817c4ce25763185811cba24c19bef67 --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Merge/AssessmentSectionMerger.cs (.../AssessmentSectionMerger.cs) (revision aa69c30a42cc90d74f4f219134a5af877dc4e857) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Merge/AssessmentSectionMerger.cs (.../AssessmentSectionMerger.cs) (revision 7e75faf99817c4ce25763185811cba24c19bef67) @@ -23,7 +23,6 @@ using System.Collections.Generic; using System.Linq; using log4net; -using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Integration.Data; using Ringtoets.Integration.Data.Merge; using Ringtoets.Integration.Forms.Merge; Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Merge/AssessmentSectionProvider.cs =================================================================== diff -u -r7fef5ada51843b4bfd4cfe03d511fb86051c78a7 -r7e75faf99817c4ce25763185811cba24c19bef67 --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Merge/AssessmentSectionProvider.cs (.../AssessmentSectionProvider.cs) (revision 7fef5ada51843b4bfd4cfe03d511fb86051c78a7) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Merge/AssessmentSectionProvider.cs (.../AssessmentSectionProvider.cs) (revision 7e75faf99817c4ce25763185811cba24c19bef67) @@ -36,7 +36,6 @@ public class AssessmentSectionProvider : IAssessmentSectionProvider { private readonly IWin32Window viewParent; - private readonly AssessmentSectionsOwner assessmentSectionsOwner; /// /// Initializes a new instance of . @@ -52,7 +51,6 @@ } this.viewParent = viewParent; - assessmentSectionsOwner = new AssessmentSectionsOwner(); } public IEnumerable GetAssessmentSections(string filePath) @@ -62,6 +60,8 @@ throw new ArgumentNullException(nameof(filePath)); } + var assessmentSectionsOwner = new AssessmentSectionsOwner(); + ActivityProgressDialogRunner.Run(viewParent, LoadAssessmentSectionsActivityFactory.CreateLoadAssessmentSectionsActivity( assessmentSectionsOwner, new LoadAssessmentSectionService(new StorageSqLite()), Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Merge/AssessmentSectionProviderTest.cs =================================================================== diff -u -r3d87eac80e424a1690895a0375cdd66230081079 -r7e75faf99817c4ce25763185811cba24c19bef67 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Merge/AssessmentSectionProviderTest.cs (.../AssessmentSectionProviderTest.cs) (revision 3d87eac80e424a1690895a0375cdd66230081079) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Merge/AssessmentSectionProviderTest.cs (.../AssessmentSectionProviderTest.cs) (revision 7e75faf99817c4ce25763185811cba24c19bef67) @@ -130,5 +130,39 @@ Assert.AreEqual(1, assessmentSections.Count()); mocks.VerifyAll(); } + + [Test] + public void GivenGetAssessmentSectionsAlreadyCalled_WhenCallingAgainWithInvalidFilePath_ThenThrowsAssessmentSectionProviderException() + { + // Given + var mocks = new MockRepository(); + var viewParent = mocks.Stub(); + mocks.ReplayAll(); + + var provider = new AssessmentSectionProvider(viewParent); + string filePath = Path.Combine(testDataPath, "project.rtd"); + + DialogBoxHandler = (name, wnd) => + { + // Expect an activity dialog which is automatically closed + }; + + IEnumerable assessmentSections = provider.GetAssessmentSections(filePath); + + // Precondition + Assert.AreEqual(1, assessmentSections.Count()); + + DialogBoxHandler = (name, wnd) => + { + // Expect an activity dialog which is automatically closed + }; + + // When + TestDelegate call = () => assessmentSections = provider.GetAssessmentSections("filePath"); + + // Then + Assert.Throws(call); + mocks.VerifyAll(); + } } } \ No newline at end of file