Workaround: Assert.Throws fails even if the exception type was correct.

This commit is contained in:
lukeIam committed 2018-03-23 14:59:53 +01:00
1 parent 016a64f4f2
commit 3af073c0d1
1 file changed
+4 -1
+4 -1
View File
@@ -137,7 +137,10 @@ namespace Tests.VocaluxeLib.XML
private static void _AssertFail<T, T2>(String xmlString) where T2 : Exception where T : new() private static void _AssertFail<T, T2>(String xmlString) where T2 : Exception where T : new()
{ {
var deserializer = new CXmlDeserializer(); var deserializer = new CXmlDeserializer();
Assert.Throws<T2>(() => deserializer.DeserializeString<T>(xmlString));
Exception exception =
Assert.Catch(() => deserializer.DeserializeString<T>(xmlString));
Assert.IsInstanceOf(typeof(T2), exception);
} }
private static T _AssertSerDeserMatch<T>(string xmlString) where T : new() private static T _AssertSerDeserMatch<T>(string xmlString) where T : new()