Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/SoilProfile1DReaderTest.cs =================================================================== diff -u -ra331d81d2e74e59fc82643c0313105c61afcd654 -r28064349855037e892288c81383f1413f4e84f4c --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/SoilProfile1DReaderTest.cs (.../SoilProfile1DReaderTest.cs) (revision a331d81d2e74e59fc82643c0313105c61afcd654) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/SoilProfile1DReaderTest.cs (.../SoilProfile1DReaderTest.cs) (revision 28064349855037e892288c81383f1413f4e84f4c) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System.Collections.Generic; using System.Collections.ObjectModel; using System.Drawing; using System.IO; @@ -110,6 +111,40 @@ } [Test] + public void GivenReadSoilProfileThrowsException_WhenReadingNextProfile_ReturnsNextProfile() + { + // Given + string dbFile = Path.Combine(testDataPath, "1dprofileWithInvalidLayerProperty.soil"); + + SoilProfileReadException exception = null; + var readSoilProfiles = new List(); + using (var reader = new SoilProfile1DReader(dbFile)) + { + reader.Initialize(); + + // When + try + { + reader.ReadSoilProfile(); + } + catch (SoilProfileReadException e) + { + exception = e; + } + + // Then + readSoilProfiles.Add(reader.ReadSoilProfile()); + } + + Assert.IsInstanceOf(exception); + Assert.AreEqual("Profile", exception.ProfileName); + Assert.AreEqual(1, readSoilProfiles.Count); + Assert.AreEqual("Profile2", readSoilProfiles[0].Name); + + Assert.IsTrue(TestHelper.CanOpenFileForWrite(dbFile)); + } + + [Test] public void ReadSoilProfile_DatabaseWith1DAnd1DSoilProfileWithoutSoilLayers_ReturnOneProfile() { // Setup