diff options
author | JamesNK <james@newtonking.com> | 2010-03-23 03:21:57 +0300 |
---|---|---|
committer | JamesNK <james@newtonking.com> | 2010-03-23 03:21:57 +0300 |
commit | 7f7cccd598038f9e51d8b121f04373702cd1d7eb (patch) | |
tree | 4c70ee7b4478483fcacd065b61a00be212eee7cf /Src/Newtonsoft.Json.Tests/Utilities | |
parent | 408a407105b5cee654caebc0ef2d80f29f2f6990 (diff) |
-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
Diffstat (limited to 'Src/Newtonsoft.Json.Tests/Utilities')
-rw-r--r-- | Src/Newtonsoft.Json.Tests/Utilities/DynamicReflectionDelegateFactoryTests.cs | 18 |
1 files changed, 18 insertions, 0 deletions
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<object, object> call = DynamicReflectionDelegateFactory.Instance.CreateMethodCall<object>(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 |