Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.Test/Exceptions/HydraulicBoundaryDatabaseReadExceptionTest.cs =================================================================== diff -u -rce31448a066c084f755439f3e7d453bfb042b291 -r49c5da81f49a23dd6e66526d264a08bf510e6963 --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.Test/Exceptions/HydraulicBoundaryDatabaseReadExceptionTest.cs (.../HydraulicBoundaryDatabaseReadExceptionTest.cs) (revision ce31448a066c084f755439f3e7d453bfb042b291) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.Test/Exceptions/HydraulicBoundaryDatabaseReadExceptionTest.cs (.../HydraulicBoundaryDatabaseReadExceptionTest.cs) (revision 49c5da81f49a23dd6e66526d264a08bf510e6963) @@ -20,6 +20,7 @@ // All rights reserved. using System; +using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.HydraRing.IO.Exceptions; @@ -73,5 +74,27 @@ Assert.AreSame(expectedInnerException, exception.InnerException); Assert.AreEqual(expectedMessage, exception.Message); } + + [Test] + public void Constructor_SerializationRoundTrip_ExceptionProperlyInitialized() + { + // Setup + var originalInnerException = new Exception("inner"); + var originalException = new HydraulicBoundaryDatabaseReadException("outer", originalInnerException); + + // Precondition + Assert.IsNotNull(originalException.InnerException); + Assert.IsNull(originalException.InnerException.InnerException); + + // Call + HydraulicBoundaryDatabaseReadException persistedException = SerializationTestHelper.SerializeAndDeserializeException(originalException); + + // Assert + Assert.AreEqual(originalException.Message, persistedException.Message); + Assert.IsNotNull(persistedException.InnerException); + Assert.AreEqual(originalException.InnerException.GetType(), persistedException.InnerException.GetType()); + Assert.AreEqual(originalException.InnerException.Message, persistedException.InnerException.Message); + Assert.IsNull(persistedException.InnerException.InnerException); + } } } \ No newline at end of file