mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-20 07:19:18 +01:00
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:
parent
35877640e0
commit
220311829b
@ -69,6 +69,7 @@ namespace XenAdminTests.UnitTests
|
|||||||
Assert.AreEqual(failure.ShortMessage, deserializedFailure.ShortMessage, "ShortMessage is different");
|
Assert.AreEqual(failure.ShortMessage, deserializedFailure.ShortMessage, "ShortMessage is different");
|
||||||
if (failure.ErrorDescription != null)
|
if (failure.ErrorDescription != null)
|
||||||
{
|
{
|
||||||
|
Assert.IsNotNull(deserializedFailure.ErrorDescription);
|
||||||
Assert.AreEqual(failure.ErrorDescription.Count, deserializedFailure.ErrorDescription.Count,
|
Assert.AreEqual(failure.ErrorDescription.Count, deserializedFailure.ErrorDescription.Count,
|
||||||
"ErrorDescription count is different");
|
"ErrorDescription count is different");
|
||||||
for (int i = 0; i < failure.ErrorDescription.Count; i++)
|
for (int i = 0; i < failure.ErrorDescription.Count; i++)
|
||||||
@ -77,10 +78,20 @@ namespace XenAdminTests.UnitTests
|
|||||||
string.Format("ErrorDescription[{0}] count is different", i));
|
string.Format("ErrorDescription[{0}] count is different", i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Assert.IsNull(deserializedFailure.ErrorDescription);
|
||||||
|
}
|
||||||
|
|
||||||
if (failure.InnerException != null)
|
if (failure.InnerException != null)
|
||||||
{
|
{
|
||||||
|
Assert.IsNotNull(deserializedFailure.InnerException);
|
||||||
Assert.AreEqual(failure.InnerException.Message, deserializedFailure.InnerException.Message, "Message is different");
|
Assert.AreEqual(failure.InnerException.Message, deserializedFailure.InnerException.Message, "Message is different");
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Assert.IsNull(deserializedFailure.InnerException);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user