public void CastleTestClass1() { var proxyGenerator = new ProxyGenerator(); var originalObj = new SimpleSpecialDisposable(); var newObj = proxyGenerator.CreateClassProxyWithTarget(originalObj, Enumerable.Empty <IInterceptor>().ToArray()); Assert.IsAssignableFrom <IDisposable>(newObj); Assert.IsAssignableFrom <ISpecialDisposable>(newObj); Assert.IsAssignableFrom <SimpleSpecialDisposable>(newObj); }
public void CastleTestInterfaces() { var proxyGenerator = new ProxyGenerator(); var originalObj = new SimpleSpecialDisposable(); var newObj = proxyGenerator.CreateInterfaceProxyWithTarget(typeof(IDisposable), originalObj, Enumerable.Empty <IInterceptor>().ToArray()); Assert.IsAssignableFrom <IDisposable>(newObj); Assert.Throws <InvalidCastException>(() => (ISpecialDisposable)newObj); Assert.Throws <InvalidCastException>(() => (SimpleSpecialDisposable)newObj); }
public void CastleTestInterfaces() { var proxyGenerator = new ProxyGenerator(); var originalObj = new SimpleSpecialDisposable(); var newObj = proxyGenerator.CreateInterfaceProxyWithTarget(typeof(IDisposable), originalObj, Enumerable.Empty<IInterceptor>().ToArray()); Assert.IsAssignableFrom<IDisposable>(newObj); Assert.Throws<InvalidCastException>(() => (ISpecialDisposable)newObj); Assert.Throws<InvalidCastException>(() => (SimpleSpecialDisposable)newObj); }
public void CastleTestClass1() { var proxyGenerator = new ProxyGenerator(); var originalObj = new SimpleSpecialDisposable(); var newObj = proxyGenerator.CreateClassProxyWithTarget(originalObj, Enumerable.Empty<IInterceptor>().ToArray()); Assert.IsAssignableFrom<IDisposable>(newObj); Assert.IsAssignableFrom<ISpecialDisposable>(newObj); Assert.IsAssignableFrom<SimpleSpecialDisposable>(newObj); }