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