public void WhenInjectorCreatesInstanceOfWrappableTypeWithCallHandlerAttributes_ThenItUsesTheSuppliedConstructorParameters() { WrappableWithAttributes wrappable = this.policyInjector.Create <WrappableWithAttributes>(); wrappable.Method(); wrappable.Method(); wrappable.Method3(); Assert.AreEqual(2, this.callCounter.Calls.Count); Assert.AreEqual(2, this.callCounter.Calls["Method"]); Assert.AreEqual(1, this.callCounter.Calls["Method3"]); }
public void WhenInjectorCreatesInstanceOfWrappableTypeWithCallHandlerAttributes_ThenMethodCallsAreIntercepted() { WrappableWithAttributes wrappable = this.policyInjector.Create <WrappableWithAttributes>(); wrappable.Method(); wrappable.Method(); wrappable.Method3(); Assert.AreEqual(2, this.callCounter.Calls.Count); Assert.AreEqual(2, this.callCounter.Calls["Method"]); Assert.AreEqual(1, this.callCounter.Calls["Method3"]); }
public void WhenInjectorWrapsInstanceOfWrappableTypeWithCallHandlerAttributes_ThenMethodCallsAreIntercepted() { WrappableWithAttributes wrappable = this.policyInjector.Wrap <WrappableWithAttributes>(new WrappableWithAttributes()); wrappable.Method(); wrappable.Method(); wrappable.Method3(); Assert.AreEqual(2, GlobalCountCallHandler.Calls.Count); Assert.AreEqual(2, GlobalCountCallHandler.Calls["Method"]); Assert.AreEqual(1, GlobalCountCallHandler.Calls["Method3"]); }
public void WhenInjectorWrapsInstanceOfWrappableTypeWithCallHandlerAttributesWithNonGenericMethods_ThenMethodCallsAreIntercepted() { WrappableWithAttributes wrappable = (WrappableWithAttributes)this.policyInjector.Wrap(typeof(WrappableWithAttributes), new WrappableWithAttributes()); wrappable.Method(); wrappable.Method(); wrappable.Method3(); Assert.AreEqual(2, this.callCounter.Calls.Count); Assert.AreEqual(2, this.callCounter.Calls["Method"]); Assert.AreEqual(1, this.callCounter.Calls["Method3"]); }
public void CanWrapObjectWithInterceptionAttributesWithNonGenericMethods() { GlobalCountCallHandler.Calls.Clear(); WrappableWithAttributes wrappable = (WrappableWithAttributes)PolicyInjection.Wrap(typeof(WrappableWithAttributes), new WrappableWithAttributes()); wrappable.Method(); wrappable.Method(); wrappable.Method3(); Assert.AreEqual(2, GlobalCountCallHandler.Calls.Count); Assert.AreEqual(2, GlobalCountCallHandler.Calls["Method"]); Assert.AreEqual(1, GlobalCountCallHandler.Calls["Method3"]); }
public void CanWrapObjectWithInterceptionAttributes() { GlobalCountCallHandler.Calls.Clear(); WrappableWithAttributes wrappable = PolicyInjection.Wrap <WrappableWithAttributes>(new WrappableWithAttributes()); wrappable.Method(); wrappable.Method(); wrappable.Method3(); Assert.AreEqual(2, GlobalCountCallHandler.Calls.Count); Assert.AreEqual(2, GlobalCountCallHandler.Calls["Method"]); Assert.AreEqual(1, GlobalCountCallHandler.Calls["Method3"]); }
public void CanCreateWrappedObjectWithInterceptionAttributesWithConstructorParameters() { GlobalCountCallHandler.Calls.Clear(); WrappableWithAttributes wrappable = PolicyInjection.Create <WrappableWithAttributes>(10, "foo"); wrappable.Method(); wrappable.Method(); wrappable.Method3(); Assert.IsFalse(wrappable.DefaultCtorCalled); Assert.AreEqual(2, GlobalCountCallHandler.Calls.Count); Assert.AreEqual(2, GlobalCountCallHandler.Calls["Method"]); Assert.AreEqual(1, GlobalCountCallHandler.Calls["Method3"]); }