예제 #1
0
 public void TestAfter()
 {
     try
     {
         MyComponent my = new MyComponent();
         Assert.IsFalse(MyAfterAdvisor.executed);
         my.AddOne(3);
         Assert.IsTrue(MyAfterAdvisor.executed);
     }
     finally
     {
         MyAfterAdvisor.executed = false;
     }
 }
예제 #2
0
        public void TestAround()
        {
            try
            {
                MyComponent my = new MyComponent();

                my.AddCount();
                Assert.IsTrue(MyAroundAdvisor.around_a);
                Assert.AreEqual(1, my.Count);
            }
            finally
            {
                MyAroundAdvisor.around_a = false;
            }
        }
예제 #3
0
 public void TestBefore()
 {
     try
     {
         MyComponent my = new MyComponent();
         int         j  = 4;
         Assert.IsTrue(!MyBeforeAdvisor.executed);
         bool b = my.Run("Hello", ref j);
         Assert.IsTrue(MyBeforeAdvisor.executed);
     }
     finally
     {
         MyBeforeAdvisor.executed = false;
     }
 }
예제 #4
0
        public void TestAroundNotProceed()
        {
            MyComponent my = new MyComponent();

            my.AddCount();
            MyAroundAdvisor.around_b = false;

            try
            {
                my.Reset();//Method will be skip
                Assert.IsTrue(MyAroundAdvisor.around_b);
                Assert.AreEqual(1, my.Count);
            }
            finally
            {
                MyAroundAdvisor.around_b = false;
            }
        }