diff options
author | JamesNK <james@newtonking.com> | 2010-07-06 14:20:10 +0400 |
---|---|---|
committer | JamesNK <james@newtonking.com> | 2010-07-06 14:20:10 +0400 |
commit | 08b8477f5e1458fc98d95e5d33ede6c8fa115478 (patch) | |
tree | 0109fe8eed42bcbe5cea74d18befe4492ee31067 /Src/Newtonsoft.Json.Tests/Utilities | |
parent | c2800930ab4a66710c56d5aa6c3fb32269af0446 (diff) |
-Fixed generating generic simple type names
-Changed JsonObjectAttribute to be compatible with structs
Diffstat (limited to 'Src/Newtonsoft.Json.Tests/Utilities')
-rw-r--r-- | Src/Newtonsoft.Json.Tests/Utilities/ReflectionUtilsTests.cs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Src/Newtonsoft.Json.Tests/Utilities/ReflectionUtilsTests.cs b/Src/Newtonsoft.Json.Tests/Utilities/ReflectionUtilsTests.cs new file mode 100644 index 0000000..9f17faf --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/Utilities/ReflectionUtilsTests.cs @@ -0,0 +1,31 @@ +using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Serialization.Formatters;
+using System.Text;
+using NUnit.Framework;
+using Newtonsoft.Json.Utilities;
+
+namespace Newtonsoft.Json.Tests.Utilities
+{
+ public class ReflectionUtilsTests : TestFixtureBase
+ {
+ [Test]
+ public void GetTypeNameSimpleForGenericTypes()
+ {
+ string typeName;
+
+ typeName = ReflectionUtils.GetTypeName(typeof(IList<Type>), FormatterAssemblyStyle.Simple);
+ Assert.AreEqual("System.Collections.Generic.IList`1[[System.Type, mscorlib]], mscorlib", typeName);
+
+ typeName = ReflectionUtils.GetTypeName(typeof(IDictionary<IList<Type>, IList<Type>>), FormatterAssemblyStyle.Simple);
+ Assert.AreEqual("System.Collections.Generic.IDictionary`2[[System.Collections.Generic.IList`1[[System.Type, mscorlib]], mscorlib],[System.Collections.Generic.IList`1[[System.Type, mscorlib]], mscorlib]], mscorlib", typeName);
+
+ typeName = ReflectionUtils.GetTypeName(typeof(IList<>), FormatterAssemblyStyle.Simple);
+ Assert.AreEqual("System.Collections.Generic.IList`1, mscorlib", typeName);
+
+ typeName = ReflectionUtils.GetTypeName(typeof(IDictionary<,>), FormatterAssemblyStyle.Simple);
+ Assert.AreEqual("System.Collections.Generic.IDictionary`2, mscorlib", typeName);
+ }
+ }
+}
\ No newline at end of file |