Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Exceptions/EntityNotFoundExceptionTest.cs =================================================================== diff -u -rfea3ed82dfb6dfcad535eef16efcbaa9c01564ed -r49c5da81f49a23dd6e66526d264a08bf510e6963 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Exceptions/EntityNotFoundExceptionTest.cs (.../EntityNotFoundExceptionTest.cs) (revision fea3ed82dfb6dfcad535eef16efcbaa9c01564ed) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Exceptions/EntityNotFoundExceptionTest.cs (.../EntityNotFoundExceptionTest.cs) (revision 49c5da81f49a23dd6e66526d264a08bf510e6963) @@ -21,6 +21,7 @@ using System; using Application.Ringtoets.Storage.Exceptions; +using Core.Common.TestUtil; using NUnit.Framework; namespace Application.Ringtoets.Storage.Test.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 EntityNotFoundException("outer", originalInnerException); + + // Precondition + Assert.IsNotNull(originalException.InnerException); + Assert.IsNull(originalException.InnerException.InnerException); + + // Call + EntityNotFoundException 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