public void IsActiveMatchesStackState()
 {
     Assert.IsFalse(AopContext.IsActive);
     AopContext.PushProxy("Foo");
     Assert.IsTrue(AopContext.IsActive);
     AopContext.PopProxy();
     Assert.IsFalse(AopContext.IsActive);
 }
 public void SetUp()
 {
     // makes sure the context is always empty before any unit test...
     try
     {
         do
         {
             AopContext.PopProxy();
         } while (true);
     }
     catch (AopConfigException)
     {
     }
 }
        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).");
        }
 public void PopProxyWithNothingOnStack()
 {
     Assert.Throws <AopConfigException>(() => AopContext.PopProxy());
 }