Example #1
0
 public void IsActiveMatchesStackState()
 {
     Assert.IsFalse(AopContext.IsActive);
     AopContext.PushProxy("Foo");
     Assert.IsTrue(AopContext.IsActive);
     AopContext.PopProxy();
     Assert.IsFalse(AopContext.IsActive);
 }
Example #2
0
        public void CurrentProxyStackJustPeeksItDoesntPop()
        {
            string foo = "Foo";

            AopContext.PushProxy(foo);
            object fooref = AopContext.CurrentProxy;

            Assert.IsTrue(ReferenceEquals(foo, fooref),
                          "Not the exact same instance (must be).");
            // must not have been popped off the stack by looking at it...
            object foorefref = AopContext.CurrentProxy;

            Assert.IsTrue(ReferenceEquals(fooref, foorefref),
                          "Not the exact same instance (must be).");
        }