using System; using System.Collections.Generic; using System.ComponentModel.Design; using System.Reflection; using System.Text; namespace UnitTest { internal class TestTypeResolutionService : ITypeResolutionService { internal TestTypeResolutionService() { } #region ITypeResolutionService Members public Assembly GetAssembly(AssemblyName name, bool throwOnError) { throw new NotImplementedException(); } public Assembly GetAssembly(AssemblyName name) { throw new NotImplementedException(); } public string GetPathOfAssembly(AssemblyName name) { throw new NotImplementedException(); } public Type GetType(string name, bool throwOnError, bool ignoreCase) { Type returnType = Type.GetType(name, false, ignoreCase); if (returnType != null) { return returnType; } AssemblyName[] assemblyNames = Assembly.GetExecutingAssembly().GetReferencedAssemblies(); foreach (AssemblyName an in assemblyNames) { Assembly a = Assembly.Load(an); Type[] types = a.GetExportedTypes(); foreach (Type t in types) { if (t.FullName == name) { return t; } } } if (throwOnError) { throw new ArgumentException(); } return null; } public Type GetType(string name, bool throwOnError) { return this.GetType(name, throwOnError, false); } public Type GetType(string name) { return this.GetType(name, true); } public void ReferenceAssembly(AssemblyName name) { throw new NotImplementedException(); } #endregion } }