Index: Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/Piping/PipingProfileCreatorTest.cs =================================================================== diff -u -r2a49b7243807fe0b95136efd55652201164a6c74 -r30e82ab47f11b8600eff4b173b72db772ade03dc --- Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/Piping/PipingProfileCreatorTest.cs (.../PipingProfileCreatorTest.cs) (revision 2a49b7243807fe0b95136efd55652201164a6c74) +++ Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/Piping/PipingProfileCreatorTest.cs (.../PipingProfileCreatorTest.cs) (revision 30e82ab47f11b8600eff4b173b72db772ade03dc) @@ -46,7 +46,7 @@ Assert.AreEqual(expectedTop, actual.TopLevel); Assert.AreEqual(expectedBottom, actual.BottomLevel); - var pipingLayer = actual.Layers.First(); + PipingLayer pipingLayer = actual.Layers.First(); Assert.IsTrue(pipingLayer.IsAquifer); Assert.AreEqual(belowPhreaticLevel, pipingLayer.BelowPhreaticLevel); Assert.AreEqual(abovePhreaticLevel, pipingLayer.AbovePhreaticLevel); @@ -117,7 +117,7 @@ PipingProfile actual = PipingProfileCreator.Create(soilProfile); // Assert - var ordered = actual.Layers.OrderByDescending(l => l.TopLevel); + IEnumerable ordered = actual.Layers.OrderByDescending(l => l.TopLevel); CollectionAssert.AreEqual(ordered, actual.Layers); Assert.AreEqual(3, actual.Layers.Count); @@ -160,7 +160,7 @@ var soilProfile = new PipingSoilProfile(string.Empty, -2, layers); // Call - var actual = PipingProfileCreator.Create(soilProfile); + PipingProfile actual = PipingProfileCreator.Create(soilProfile); CollectionAssert.AreEqual(new[] { @@ -197,7 +197,7 @@ var soilProfile = new PipingSoilProfile(string.Empty, -2, layers); // Call - var actual = PipingProfileCreator.Create(soilProfile); + PipingProfile actual = PipingProfileCreator.Create(soilProfile); CollectionAssert.AreEqual(new[] { @@ -234,7 +234,7 @@ var soilProfile = new PipingSoilProfile(string.Empty, -2, layers); // Call - var actual = PipingProfileCreator.Create(soilProfile); + PipingProfile actual = PipingProfileCreator.Create(soilProfile); CollectionAssert.AreEqual(new[] { Index: Ringtoets/Piping/test/Ringtoets.Piping.Integration.Test/ImportSoilProfileFromDatabaseTest.cs =================================================================== diff -u -r8e258eec8318163d7ce452ffc0db1fab83f511c1 -r30e82ab47f11b8600eff4b173b72db772ade03dc --- Ringtoets/Piping/test/Ringtoets.Piping.Integration.Test/ImportSoilProfileFromDatabaseTest.cs (.../ImportSoilProfileFromDatabaseTest.cs) (revision 8e258eec8318163d7ce452ffc0db1fab83f511c1) +++ Ringtoets/Piping/test/Ringtoets.Piping.Integration.Test/ImportSoilProfileFromDatabaseTest.cs (.../ImportSoilProfileFromDatabaseTest.cs) (revision 30e82ab47f11b8600eff4b173b72db772ade03dc) @@ -11,11 +11,12 @@ { public class ImportSoilProfileFromDatabaseTest { + private readonly string testDataPath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Piping.IO, "PipingSoilProfilesReader"); + [Test] public void GivenDatabaseWithSimple1DProfile_WhenImportingPipingProfile_ThenPipingProfileHasValuesCorrectlySet() { // Given - string testDataPath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Piping.IO, "PipingSoilProfilesReader"); var databasePath = Path.Combine(testDataPath, "1dprofile.soil"); var pipingFailureMechanism = new PipingFailureMechanism(); @@ -27,7 +28,7 @@ Assert.AreEqual(1, pipingFailureMechanism.SoilProfiles.Count()); PipingSoilProfile profile = pipingFailureMechanism.SoilProfiles.ElementAt(0); - var pipingProfile = PipingProfileCreator.Create(profile); + PipingProfile pipingProfile = PipingProfileCreator.Create(profile); var defaultPipingLayer = new PipingLayer(); @@ -40,11 +41,14 @@ CollectionAssert.AreEqual(new[] { 3.3, 2.2, 1.1 }, pipingProfile.Layers.Select(l => l.TopLevel)); } + /// + /// This database contains 2 profiles. One of the profiles has an invalid layer geometry and should be skipped by the importer. + /// The other profile has valid geometries for its layers and should have the values correctly set. + /// [Test] public void GivenDatabaseWithValid2DProfileAnd2dProfileWithInvalidLayerGeometry_WhenImportingPipingProfile_ThenValidPipingProfileHasValuesCorrectlySet() { // Given - string testDataPath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Piping.IO, "PipingSoilProfilesReader"); var databasePath = Path.Combine(testDataPath, "invalid2dGeometry.soil"); var pipingFailureMechanism = new PipingFailureMechanism(); @@ -56,7 +60,7 @@ Assert.AreEqual(1, pipingFailureMechanism.SoilProfiles.Count()); PipingSoilProfile profile = pipingFailureMechanism.SoilProfiles.ElementAt(0); - var pipingProfile = PipingProfileCreator.Create(profile); + PipingProfile pipingProfile = PipingProfileCreator.Create(profile); Assert.AreEqual(1.25, pipingProfile.BottomLevel); Assert.AreEqual(3, pipingProfile.Layers.Count); @@ -71,7 +75,6 @@ public void GivenDatabaseWithNoLayerValues_WhenImportingPipingProfile_ThenValidPipingProfileWithDefaultValuesCreated() { // Given - string testDataPath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Piping.IO, "PipingSoilProfilesReader"); var databasePath = Path.Combine(testDataPath, "1dprofileNoValues.soil"); var pipingFailureMechanism = new PipingFailureMechanism(); @@ -83,7 +86,7 @@ Assert.AreEqual(1, pipingFailureMechanism.SoilProfiles.Count()); PipingSoilProfile profile = pipingFailureMechanism.SoilProfiles.ElementAt(0); - var pipingProfile = PipingProfileCreator.Create(profile); + PipingProfile pipingProfile = PipingProfileCreator.Create(profile); var defaultPipingLayer = new PipingLayer(); Assert.AreEqual(-2.1, pipingProfile.BottomLevel);