From d49d7d1b0f4ec2029a15e2c2a5fd3f278b947d8c Mon Sep 17 00:00:00 2001 From: James Newton-King Date: Mon, 23 Apr 2012 22:25:35 +1200 Subject: [PATCH] -Fixed test when assembly strong named --- .../Serialization/TypeNameHandlingTests.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Src/Newtonsoft.Json.Tests/Serialization/TypeNameHandlingTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/TypeNameHandlingTests.cs index c370515c..b4c49820 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/TypeNameHandlingTests.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/TypeNameHandlingTests.cs @@ -271,16 +271,18 @@ namespace Newtonsoft.Json.Tests.Serialization ""Manager"": null }"; - ExceptionAssert.Throws( - @"Type specified in JSON '" + employeeRef + @"' is not compatible with '" + personRef + @"'. Path '$type', line 3, position 143.", - () => + try + { + JsonConvert.DeserializeObject(json, typeof(Person), new JsonSerializerSettings { - JsonConvert.DeserializeObject(json, typeof(Person), new JsonSerializerSettings - { - TypeNameHandling = TypeNameHandling.Objects, - TypeNameAssemblyFormat = FormatterAssemblyStyle.Full - }); + TypeNameHandling = TypeNameHandling.Objects, + TypeNameAssemblyFormat = FormatterAssemblyStyle.Full }); + } + catch (JsonSerializationException ex) + { + Assert.IsTrue(ex.Message.StartsWith(@"Type specified in JSON '" + employeeRef + @"' is not compatible with '" + personRef + @"'.")); + } } [Test]