All files
[pithos-ms-client] / trunk / Libraries / Json40r2 / Source / Src / Newtonsoft.Json.Tests / Utilities / ReflectionUtilsTests.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Runtime.Serialization.Formatters;
5 using System.Text;
6 using NUnit.Framework;
7 using Newtonsoft.Json.Utilities;
8
9 namespace Newtonsoft.Json.Tests.Utilities
10 {
11   public class ReflectionUtilsTests : TestFixtureBase
12   {
13     [Test]
14     public void GetTypeNameSimpleForGenericTypes()
15     {
16       string typeName;
17
18       typeName = ReflectionUtils.GetTypeName(typeof(IList<Type>), FormatterAssemblyStyle.Simple);
19       Assert.AreEqual("System.Collections.Generic.IList`1[[System.Type, mscorlib]], mscorlib", typeName);
20
21       typeName = ReflectionUtils.GetTypeName(typeof(IDictionary<IList<Type>, IList<Type>>), FormatterAssemblyStyle.Simple);
22       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);
23
24       typeName = ReflectionUtils.GetTypeName(typeof(IList<>), FormatterAssemblyStyle.Simple);
25       Assert.AreEqual("System.Collections.Generic.IList`1, mscorlib", typeName);
26
27       typeName = ReflectionUtils.GetTypeName(typeof(IDictionary<,>), FormatterAssemblyStyle.Simple);
28       Assert.AreEqual("System.Collections.Generic.IDictionary`2, mscorlib", typeName);
29     }
30   }
31 }