public void DomainTypeResolver_Test() { DomainTypeResolver resolver = new DomainTypeResolver(true); Assert.AreEqual(typeof(object), resolver.ResolveType("object")); Assert.AreEqual(typeof(Int32), resolver.ResolveType("int")); Assert.AreEqual(typeof(object[]), resolver.ResolveType("object[]")); }
public void AddTypeAlias_Test() { DomainTypeResolver resolver = new DomainTypeResolver(false); DomainTypeResolver ignoreCaseResolver = new DomainTypeResolver(true); resolver.AddAssemblyAlias("test", "Moonlit.TestFixtures, Version=1.0.0.0, Culture=neutral"); resolver.AddTypeAlias("int", typeof(Int32)); Assert.AreEqual(typeof(Int32), ignoreCaseResolver.ResolveType("int")); Assert.AreEqual(typeof(Int32), ignoreCaseResolver.ResolveType("Int")); Assert.IsNull(resolver.ResolveType("Int")); }
public void ResolveType_Test() { DomainTypeResolver resolver = new DomainTypeResolver(false); DomainTypeResolver ignoreCaseResolver = new DomainTypeResolver(true); Assert.IsNull(resolver.ResolveType("moonlit.testfixtures.democlass, moonlit.testfixtures, version=1.0.0.0, culture=neutral")); Assert.IsNull(resolver.ResolveType("moonlit.testfixtures.democlass, moonlit.testfixtures, version=1.0.0.0")); Assert.IsNull(resolver.ResolveType("moonlit.testfixtures.democlass, moonlit.testfixtures")); Assert.AreEqual(typeof(DemoClass), ignoreCaseResolver.ResolveType("moonlit.testfixtures.democlass, moonlit.testfixtures, version=1.0.0.0, culture=neutral")); Assert.AreEqual(typeof(DemoClass), ignoreCaseResolver.ResolveType("moonlit.testfixtures.democlass, moonlit.testfixtures, version=1.0.0.0")); Assert.AreEqual(typeof(DemoClass), ignoreCaseResolver.ResolveType("moonlit.testfixtures.democlass, moonlit.testfixtures")); Assert.AreEqual(typeof(DemoClass), resolver.ResolveType("Moonlit.TestFixtures.DemoClass, Moonlit.TestFixtures, Version=1.0.0.0, Culture=neutral")); Assert.AreEqual(typeof(DemoClass), resolver.ResolveType("Moonlit.TestFixtures.DemoClass, Moonlit.TestFixtures, Version=1.0.0.0")); Assert.AreEqual(typeof(DemoClass), resolver.ResolveType("Moonlit.TestFixtures.DemoClass, Moonlit.TestFixtures")); }
public void AddAssemblyAlias_Test() { DomainTypeResolver resolver = new DomainTypeResolver(true); resolver.AddAssemblyAlias("test", "Moonlit.TestFixtures, Version=1.0.0.0, Culture=neutral"); Assert.AreEqual(typeof(DemoClass), resolver.ResolveType("Moonlit.TestFixtures.DemoClass, test")); }