Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/FileImporters/StructuresImporterTest.cs =================================================================== diff -u -ra8d5814e2cb003b85852c499cbc25ca0156887d4 -r207fcf758cac8237b31af99f7f54278b32eba658 --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/FileImporters/StructuresImporterTest.cs (.../StructuresImporterTest.cs) (revision a8d5814e2cb003b85852c499cbc25ca0156887d4) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/FileImporters/StructuresImporterTest.cs (.../StructuresImporterTest.cs) (revision 207fcf758cac8237b31af99f7f54278b32eba658) @@ -506,7 +506,7 @@ } [Test] - public void Import_CreateSpecificStructuresThrowsUpdateDataException_ReturnFalseAndLogError() + public void Import_UpdateWithCreatedStructuresThrowsUpdateDataException_ReturnFalseAndLogError() { // Setup var messageProvider = mocks.StrictMock(); @@ -515,14 +515,14 @@ mocks.ReplayAll(); string filePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Common.IO, - Path.Combine("Structures", "CorrectFiles", - "Kunstwerken.shp")); + Path.Combine("Structures", "CorrectFiles", + "Kunstwerken.shp")); ReferenceLine referenceLine = CreateReferenceLine(); var importer = new TestStructuresImporter(new ObservableList(), referenceLine, filePath, messageProvider) { - CreateSpecificStructuresAction = () => { throw new UpdateDataException("Exception message"); } + UpdateWithCreatedStructuresAction = () => { throw new UpdateDataException("Exception message"); } }; var importResult = true; @@ -537,6 +537,42 @@ } [Test] + public void DoPostImport_UpdateWithCreatedStructuresReturnsObservables_ObservablesNotified() + { + // Setup + var messageProvider = mocks.Stub(); + var observableA = mocks.StrictMock(); + observableA.Expect(o => o.NotifyObservers()); + var observableB = mocks.StrictMock(); + observableB.Expect(o => o.NotifyObservers()); + mocks.ReplayAll(); + + string filePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Common.IO, + Path.Combine("Structures", "CorrectFiles", + "Kunstwerken.shp")); + + ReferenceLine referenceLine = CreateReferenceLine(); + IObservable[] observables = + { + observableA, + observableB + }; + var importer = new TestStructuresImporter(new ObservableList(), referenceLine, + filePath, messageProvider) + { + UpdateWithCreatedStructuresAction = () => observables + }; + + importer.Import(); + + // Call + importer.DoPostImport(); + + // Then + // Assertions performed in TearDown + } + + [Test] public void GetStandardDeviation_RowHasStandardDeviation_ReturnVarianceValue() { // Setup @@ -706,7 +742,7 @@ private class TestStructuresImporter : StructuresImporter> { - public Action CreateSpecificStructuresAction; + public Func> UpdateWithCreatedStructuresAction; public TestStructuresImporter(ObservableList importTarget, ReferenceLine referenceLine, string filePath, IImporterMessageProvider messageProvider) @@ -722,10 +758,10 @@ return base.GetCoefficientOfVariation(parameter, structureName); } - protected override void CreateSpecificStructures(ICollection structureLocations, - Dictionary> groupedStructureParameterRows) + protected override IEnumerable UpdateWithCreatedStructures(ICollection structureLocations, + Dictionary> groupedStructureParameterRows) { - CreateSpecificStructuresAction?.Invoke(); + return UpdateWithCreatedStructuresAction?.Invoke(); } } }