public void CreateProxyFromAbstractClassAndInterceptByTest() { // Arrange var interceptor = new CountingInterceptor(); // Act var proxy = _proxyFactory.CreateProxy<FooBase>() .InterceptBy(interceptor) .Target<Foo>(); // Assert Assert.That(proxy, Is.InstanceOf<FooBase>()); Assert.DoesNotThrow(proxy.Bar); Assert.That(interceptor.InvocationCount, Is.EqualTo(1)); }
public void CreateProxyFromDelegateAndInterceptByTest() { // Arrange var interceptor = new CountingInterceptor(); // Act var proxy = _proxyFactory.CreateProxy <Action>() .InterceptBy(interceptor) .Target(() => { }); // Assert Assert.That(proxy, Is.InstanceOf <Action>()); Assert.DoesNotThrow(() => proxy()); Assert.That(interceptor.InvocationCount, Is.EqualTo(1)); }
public void CreateProxyFromClassAndInterceptByTest() { // Arrange var interceptor = new CountingInterceptor(); // Act var proxy = _proxyFactory.CreateProxy <Foo>() .InterceptBy(interceptor) .Target <Foo>(); // Assert Assert.That(proxy, Is.InstanceOf <Foo>()); Assert.DoesNotThrow(proxy.Bar); Assert.That(interceptor.InvocationCount, Is.EqualTo(1)); }
public void CreateProxyFromDelegateAndInterceptByTest() { // Arrange var interceptor = new CountingInterceptor(); // Act var proxy = _proxyFactory.CreateProxy<Action>() .InterceptBy(interceptor) .Target(() => { }); // Assert Assert.That(proxy, Is.InstanceOf<Action>()); Assert.DoesNotThrow(() => proxy()); Assert.That(interceptor.InvocationCount, Is.EqualTo(1)); }