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 SetUp()
 {
     // makes sure the context is always empty before any unit test...
     try
     {
         do
         {
             AopContext.PopProxy();
         } while (true);
     }
     catch (AopConfigException)
     {
     }
 }
Example #3
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).");
        }
Example #4
0
 public void PopProxyWithNothingOnStack()
 {
     Assert.Throws <AopConfigException>(() => AopContext.PopProxy());
 }