Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/RingtoetsPipingSurfaceLineUpdateDataStrategyTest.cs =================================================================== diff -u -r393f18543bc78061b83f61fce09ca094d8fb1a05 -r92549be285a5082435e9625732cf33ff50cd60b9 --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/RingtoetsPipingSurfaceLineUpdateDataStrategyTest.cs (.../RingtoetsPipingSurfaceLineUpdateDataStrategyTest.cs) (revision 393f18543bc78061b83f61fce09ca094d8fb1a05) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/RingtoetsPipingSurfaceLineUpdateDataStrategyTest.cs (.../RingtoetsPipingSurfaceLineUpdateDataStrategyTest.cs) (revision 92549be285a5082435e9625732cf33ff50cd60b9) @@ -55,7 +55,7 @@ var strategy = new RingtoetsPipingSurfaceLineUpdateDataStrategy(new PipingFailureMechanism()); // Assert - Assert.IsInstanceOf(strategy); + Assert.IsInstanceOf(strategy); } [Test] @@ -79,7 +79,7 @@ var strategy = new RingtoetsPipingSurfaceLineUpdateDataStrategy(new PipingFailureMechanism()); // Call - TestDelegate test = () => strategy.UpdateSurfaceLinesWithImportedData(new RingtoetsPipingSurfaceLineCollection(), + TestDelegate test = () => strategy.UpdateSurfaceLinesWithImportedData(new RingtoetsPipingSurfaceLineCollection(), null, string.Empty); @@ -95,7 +95,7 @@ var strategy = new RingtoetsPipingSurfaceLineUpdateDataStrategy(new PipingFailureMechanism()); // Call - TestDelegate test = () => strategy.UpdateSurfaceLinesWithImportedData(new RingtoetsPipingSurfaceLineCollection(), + TestDelegate test = () => strategy.UpdateSurfaceLinesWithImportedData(new RingtoetsPipingSurfaceLineCollection(), Enumerable.Empty(), null); @@ -141,15 +141,27 @@ { // Setup const string duplicateName = "Duplicate name it is"; - var targetCollection = new RingtoetsPipingSurfaceLineCollection(); - targetCollection.AddRange(new[] + + var expectedSurfaceLine = new RingtoetsPipingSurfaceLine { - new RingtoetsPipingSurfaceLine - { - Name = duplicateName - } - }, sourceFilePath); + Name = duplicateName + }; + Point3D[] expectedGeometry = + { + new Point3D(0, 1, 2), + new Point3D(3, 4, 5), + new Point3D(6, 7, 8) + }; + expectedSurfaceLine.SetGeometry(expectedGeometry); + var expectedCollection = new[] + { + expectedSurfaceLine + }; + + var targetCollection = new RingtoetsPipingSurfaceLineCollection(); + targetCollection.AddRange(expectedCollection, sourceFilePath); + RingtoetsPipingSurfaceLine[] importedSurfaceLines = { new RingtoetsPipingSurfaceLine @@ -173,6 +185,11 @@ var exception = Assert.Throws(call); Assert.AreEqual("Het bijwerken van de profielschematisaties is mislukt.", exception.Message); Assert.IsInstanceOf(exception.InnerException); + + CollectionAssert.AreEqual(expectedCollection, targetCollection); + RingtoetsPipingSurfaceLine actualSurfaceLine = targetCollection[0]; + Assert.AreEqual(expectedSurfaceLine.Name, actualSurfaceLine.Name); + CollectionAssert.AreEqual(expectedGeometry, actualSurfaceLine.Points); } [Test] @@ -249,37 +266,5 @@ targetSurfaceLine }, affectedObjects); } - - [Test] - public void UpdateSurfaceLinesWithImportedData_ImportedDataContainsDuplicateNames_ThrowsUpdateException() - { - // Setup - const string duplicateName = "Duplicate name it is"; - RingtoetsPipingSurfaceLine[] importedSurfaceLines = - { - new RingtoetsPipingSurfaceLine - { - Name = duplicateName - }, - new RingtoetsPipingSurfaceLine - { - Name = duplicateName - } - }; - - var failureMechanism = new PipingFailureMechanism(); - var strategy = new RingtoetsPipingSurfaceLineReplaceDataStrategy(failureMechanism); - - // Call - TestDelegate call = () => strategy.UpdateSurfaceLinesWithImportedData(failureMechanism.SurfaceLines, - importedSurfaceLines, - sourceFilePath); - - // Assert - var exception = Assert.Throws(call); - string expectedMessage = $"Profielschematisaties moeten een unieke naam hebben. Gevonden dubbele namen: {duplicateName}."; - Assert.AreEqual(expectedMessage, exception.Message); - Assert.IsInstanceOf(exception.InnerException); - } } } \ No newline at end of file