Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Builders/SoilProfileBuilderExceptionTest.cs =================================================================== diff -u -r2d7f22520e157ccfefbf12a4d9845de8bfb04f50 -r49c5da81f49a23dd6e66526d264a08bf510e6963 --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Builders/SoilProfileBuilderExceptionTest.cs (.../SoilProfileBuilderExceptionTest.cs) (revision 2d7f22520e157ccfefbf12a4d9845de8bfb04f50) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Builders/SoilProfileBuilderExceptionTest.cs (.../SoilProfileBuilderExceptionTest.cs) (revision 49c5da81f49a23dd6e66526d264a08bf510e6963) @@ -20,6 +20,7 @@ // All rights reserved. using System; +using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Piping.IO.Builders; @@ -71,5 +72,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 SoilProfileBuilderException("outer", originalInnerException); + + // Precondition + Assert.IsNotNull(originalException.InnerException); + Assert.IsNull(originalException.InnerException.InnerException); + + // Call + SoilProfileBuilderException 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