Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.IO.Test/DuneLocationsWriterTest.cs =================================================================== diff -u -rd18995d638a6c3f99cb7a8419107bb4148420301 -rf43c22c9f5dc04d352988510303fcfe12d712be8 --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.IO.Test/DuneLocationsWriterTest.cs (.../DuneLocationsWriterTest.cs) (revision d18995d638a6c3f99cb7a8419107bb4148420301) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.IO.Test/DuneLocationsWriterTest.cs (.../DuneLocationsWriterTest.cs) (revision f43c22c9f5dc04d352988510303fcfe12d712be8) @@ -115,6 +115,24 @@ } [Test] + public void WriteDuneLocations_FileInUse_ThrowCriticalFileWriteException() + { + // Setup + string filePath = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + using (new FileDisposeHelper(filePath)) + using (new FileStream(filePath, FileMode.Open)) + { + // Call + TestDelegate call = () => DuneLocationsWriter.WriteDuneLocations(Enumerable.Empty(), filePath); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual($"Er is een onverwachte fout opgetreden tijdens het schrijven van het bestand '{filePath}'.", exception.Message); + Assert.IsInstanceOf(exception.InnerException); + } + } + + [Test] public void WriteDuneLocations_ValidData_ValidFile() { // Setup Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Exporters/PipingConfigurationWriterTest.cs =================================================================== diff -u -rd18995d638a6c3f99cb7a8419107bb4148420301 -rf43c22c9f5dc04d352988510303fcfe12d712be8 --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Exporters/PipingConfigurationWriterTest.cs (.../PipingConfigurationWriterTest.cs) (revision d18995d638a6c3f99cb7a8419107bb4148420301) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Exporters/PipingConfigurationWriterTest.cs (.../PipingConfigurationWriterTest.cs) (revision f43c22c9f5dc04d352988510303fcfe12d712be8) @@ -62,6 +62,10 @@ yield return new TestCaseData("calculationWithoutSoilProfile", PipingTestDataGenerator.GetPipingCalculationWithoutSoilProfile()) .SetName("calculationWithoutSoilProfile"); + + yield return new TestCaseData("calculationWithNaNs", + PipingTestDataGenerator.GetPipingCalculationWithNaNs()) + .SetName("calculationWithNaNs"); } } @@ -145,6 +149,24 @@ } [Test] + public void Write_FileInUse_ThrowCriticalFileWriteException() + { + // Setup + string filePath = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + using (new FileDisposeHelper(filePath)) + using (new FileStream(filePath, FileMode.Open)) + { + // Call + TestDelegate call = () => PipingConfigurationWriter.Write(new CalculationGroup(), filePath); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual($"Er is een onverwachte fout opgetreden tijdens het schrijven van het bestand '{filePath}'.", exception.Message); + Assert.IsInstanceOf(exception.InnerException); + } + } + + [Test] public void Write_CalculationGroupsAndCalculation_ValidFile() { // Setup Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/test-data/PipingConfigurationWriter/calculationWithNaNs.xml =================================================================== diff -u --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/test-data/PipingConfigurationWriter/calculationWithNaNs.xml (revision 0) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/test-data/PipingConfigurationWriter/calculationWithNaNs.xml (revision f43c22c9f5dc04d352988510303fcfe12d712be8) @@ -0,0 +1,21 @@ + + + + NaN + PK001_0001 + NaN + NaN + PK001_0001_Piping + W1-6_0_1D1 + + + NaN + NaN + + + NaN + NaN + + + + \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtils/PipingTestDataGenerator.cs =================================================================== diff -u -r69617e58c64b2b6a92da02e30c308e77f9176968 -rf43c22c9f5dc04d352988510303fcfe12d712be8 --- Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtils/PipingTestDataGenerator.cs (.../PipingTestDataGenerator.cs) (revision 69617e58c64b2b6a92da02e30c308e77f9176968) +++ Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtils/PipingTestDataGenerator.cs (.../PipingTestDataGenerator.cs) (revision f43c22c9f5dc04d352988510303fcfe12d712be8) @@ -23,6 +23,7 @@ using Core.Common.Base.Geometry; using Ringtoets.Common.Data.Calculation; using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.Data.Probabilistics; using Ringtoets.Piping.Data; using Ringtoets.Piping.Data.TestUtil; using Ringtoets.Piping.KernelWrapper.TestUtil; @@ -159,6 +160,30 @@ } /// + /// Gets a with double.NaN values set. + /// + /// A with double.NaN values. + public static PipingCalculation GetPipingCalculationWithNaNs() + { + PipingCalculation calculation = GetPipingCalculationWithAssessmentLevel(); + calculation.InputParameters.AssessmentLevel = RoundedDouble.NaN; + calculation.InputParameters.EntryPointL = RoundedDouble.NaN; + calculation.InputParameters.ExitPointL = RoundedDouble.NaN; + calculation.InputParameters.PhreaticLevelExit = new NormalDistribution + { + Mean = RoundedDouble.NaN, + StandardDeviation = RoundedDouble.NaN + }; + calculation.InputParameters.DampingFactorExit = new LogNormalDistribution + { + Mean = RoundedDouble.NaN, + StandardDeviation = RoundedDouble.NaN + }; + + return calculation; + } + + /// /// Configures a to a fully configured failure /// mechanism with all possible parent and nested calculation configurations. /// Index: Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/WaveConditionsWriterTest.cs =================================================================== diff -u -rd18995d638a6c3f99cb7a8419107bb4148420301 -rf43c22c9f5dc04d352988510303fcfe12d712be8 --- Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/WaveConditionsWriterTest.cs (.../WaveConditionsWriterTest.cs) (revision d18995d638a6c3f99cb7a8419107bb4148420301) +++ Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/WaveConditionsWriterTest.cs (.../WaveConditionsWriterTest.cs) (revision f43c22c9f5dc04d352988510303fcfe12d712be8) @@ -116,6 +116,24 @@ } [Test] + public void WriteWaveConditions_FileInUse_ThrowCriticalFileWriteException() + { + // Setup + string filePath = TestHelper.GetScratchPadPath(Path.GetRandomFileName()); + using (new FileDisposeHelper(filePath)) + using (new FileStream(filePath, FileMode.Open)) + { + // Call + TestDelegate call = () => WaveConditionsWriter.WriteWaveConditions(Enumerable.Empty(), filePath); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual($"Er is een onverwachte fout opgetreden tijdens het schrijven van het bestand '{filePath}'.", exception.Message); + Assert.IsInstanceOf(exception.InnerException); + } + } + + [Test] public void WriteWaveConditions_ValidData_ValidFile() { // Setup