From 7f7cccd598038f9e51d8b121f04373702cd1d7eb Mon Sep 17 00:00:00 2001 From: JamesNK Date: Tue, 23 Mar 2010 00:21:57 +0000 Subject: -Add support for using implicit/explicit casts when converting a JSON property name to a dictionary value -Fix DynamicReflectionDelegateFactory erroring when calling static methods -Fix CustomCreationConverter to return null when converting a null JSON value --- .../Utilities/DynamicReflectionDelegateFactoryTests.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'Src/Newtonsoft.Json.Tests/Utilities') diff --git a/Src/Newtonsoft.Json.Tests/Utilities/DynamicReflectionDelegateFactoryTests.cs b/Src/Newtonsoft.Json.Tests/Utilities/DynamicReflectionDelegateFactoryTests.cs index bbe80e0..c8123fe 100644 --- a/Src/Newtonsoft.Json.Tests/Utilities/DynamicReflectionDelegateFactoryTests.cs +++ b/Src/Newtonsoft.Json.Tests/Utilities/DynamicReflectionDelegateFactoryTests.cs @@ -27,10 +27,12 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Reflection; using System.Text; using NUnit.Framework; using Newtonsoft.Json.Utilities; using Newtonsoft.Json.Tests.TestObjects; +using Newtonsoft.Json.Tests.Serialization; namespace Newtonsoft.Json.Tests.Utilities { @@ -89,6 +91,22 @@ namespace Newtonsoft.Json.Tests.Utilities setter(m, new Version()); } + + [Test] + public void CreateStaticMethodCall() + { + MethodInfo castMethodInfo = typeof(JsonSerializerTest.DictionaryKey).GetMethod("op_Implicit", new[] { typeof(string) }); + + Assert.IsNotNull(castMethodInfo); + + MethodCall call = DynamicReflectionDelegateFactory.Instance.CreateMethodCall(castMethodInfo); + + object result = call(null, "First!"); + Assert.IsNotNull(result); + + JsonSerializerTest.DictionaryKey key = (JsonSerializerTest.DictionaryKey) result; + Assert.AreEqual("First!", key.Value); + } } } #endif \ No newline at end of file -- cgit v1.2.3