From 3af073c0d1fda1efa88404b799dc8485f2bf3d9d Mon Sep 17 00:00:00 2001 From: lukeIam <2lukeiam@gmail.com> Date: Fri, 23 Mar 2018 14:59:53 +0100 Subject: [PATCH] Workaround: Assert.Throws fails even if the exception type was correct. --- Tests/VocaluxeLib/XML/CXmlSerializerTest.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Tests/VocaluxeLib/XML/CXmlSerializerTest.cs b/Tests/VocaluxeLib/XML/CXmlSerializerTest.cs index 19365e1a..89656799 100644 --- a/Tests/VocaluxeLib/XML/CXmlSerializerTest.cs +++ b/Tests/VocaluxeLib/XML/CXmlSerializerTest.cs @@ -137,7 +137,10 @@ namespace Tests.VocaluxeLib.XML private static void _AssertFail(String xmlString) where T2 : Exception where T : new() { var deserializer = new CXmlDeserializer(); - Assert.Throws(() => deserializer.DeserializeString(xmlString)); + + Exception exception = + Assert.Catch(() => deserializer.DeserializeString(xmlString)); + Assert.IsInstanceOf(typeof(T2), exception); } private static T _AssertSerDeserMatch(string xmlString) where T : new()