CA-137485: Improvements to the Exception serialization unit tests

As per code review, wherever there is an 'if' in the unit tests there should be an assertion for the 'else' branch as well

Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
This commit is contained in:
Mihaela Stoica 2014-07-04 14:44:38 +01:00
parent 35877640e0
commit 220311829b

View File

@ -69,6 +69,7 @@ namespace XenAdminTests.UnitTests
Assert.AreEqual(failure.ShortMessage, deserializedFailure.ShortMessage, "ShortMessage is different");
if (failure.ErrorDescription != null)
{
Assert.IsNotNull(deserializedFailure.ErrorDescription);
Assert.AreEqual(failure.ErrorDescription.Count, deserializedFailure.ErrorDescription.Count,
"ErrorDescription count is different");
for (int i = 0; i < failure.ErrorDescription.Count; i++)
@ -77,10 +78,20 @@ namespace XenAdminTests.UnitTests
string.Format("ErrorDescription[{0}] count is different", i));
}
}
else
{
Assert.IsNull(deserializedFailure.ErrorDescription);
}
if (failure.InnerException != null)
{
Assert.IsNotNull(deserializedFailure.InnerException);
Assert.AreEqual(failure.InnerException.Message, deserializedFailure.InnerException.Message, "Message is different");
}
else
{
Assert.IsNull(deserializedFailure.InnerException);
}
}