public static IsAssignableAndNotTransparentProxy ( |
||
type | The target |
|
instance | object | The value that should be assigned to the type. |
Résultat | bool |
public void IsAssignableAndNotTransparentProxyWithProxy() { AppDomain domain = null; try { AppDomainSetup setup = new AppDomainSetup(); setup.ApplicationBase = Environment.CurrentDirectory; domain = AppDomain.CreateDomain("Spring", new Evidence(AppDomain.CurrentDomain.Evidence), setup); object foo = domain.CreateInstanceAndUnwrap(GetType().Assembly.FullName, typeof(Foo).FullName); // the instance is definitely assignable to the supplied interface type... bool isAssignable = ObjectUtils.IsAssignableAndNotTransparentProxy(typeof(IFoo), foo); Assert.IsFalse(isAssignable, "Proxied instance was not recognized as such."); } finally { AppDomain.Unload(domain); } }