public void InterfaceInterceptionWithoutAdditionalInterfaces()
        {
            DoNothingInterceptionBehavior.Reset();
            IInterceptionBehavior[] behaviourArray = new IInterceptionBehavior[1];
            behaviourArray[0] = new DoNothingInterceptionBehavior();
            IInterfaceA target = new ImplementsInterface();
            IInterfaceA proxy  = Intercept.ThroughProxy(target, new TransparentProxyInterceptor(), behaviourArray);

            proxy.TargetMethod();
            Assert.AreEqual("Called", DoNothingInterceptionBehavior.PreCalled);
            Assert.AreEqual("Called", DoNothingInterceptionBehavior.PostCalled);
        }
Esempio n. 2
0
        public void ShouldFindAttributeOnInterface()
        {
            CustomInterceptor interceptor = new CustomInterceptor();
            MethodInfo        method      = typeof(IInterfaceWithAttribute).GetMethod("DoSomething");
            IInvocation       invocation  = Substitute.For <IInvocation>();

            invocation.Request.Method.Returns(method);
            ImplementsInterface instance = new ImplementsInterface();

            invocation.Request.Target.Returns(instance);
            CustomAttribute[] attributes = interceptor.GetAllAttributes(invocation);

            Assert.AreEqual(1, attributes.Length, "The wrong number of attributes were found.");
        }
Esempio n. 3
0
 public void SimpleInstantiation()
 {
     InterfaceToBeShared inst = new ImplementsInterface();
 }