0
|
1 using System;
|
|
2 using System.Collections;
|
|
3
|
|
4 using BLToolkit.Aspects;
|
|
5 using BLToolkit.Reflection;
|
|
6
|
|
7 using NUnit.Framework;
|
|
8
|
|
9 namespace Aspects
|
|
10 {
|
|
11 [TestFixture]
|
|
12 public class LoggingAspectTest
|
|
13 {
|
|
14 [Log]
|
|
15 public abstract class TestClass
|
|
16 {
|
|
17 public abstract int Test();
|
|
18
|
|
19 [Log("LogParameters=true")]
|
|
20 public virtual void Test(ArrayList list, int i, string s, char c)
|
|
21 {
|
|
22 }
|
|
23
|
|
24 [Log("LogParameters=true")]
|
|
25 public virtual void Test(int i)
|
|
26 {
|
|
27 throw new ApplicationException("test exception");
|
|
28 }
|
|
29 }
|
|
30
|
|
31 [Test]
|
|
32 public void Test1()
|
|
33 {
|
|
34 TestClass t = (TestClass)TypeAccessor.CreateInstance(typeof(TestClass));
|
|
35
|
|
36 t.Test();
|
|
37 t.Test(new ArrayList(), 567, "876", 'X');
|
|
38 }
|
|
39
|
|
40 [Test, ExpectedException(typeof(ApplicationException))]
|
|
41 public void Test2()
|
|
42 {
|
|
43 TestClass t = (TestClass)TypeAccessor.CreateInstance(typeof(TestClass));
|
|
44
|
|
45 t.Test(123);
|
|
46 }
|
|
47 }
|
|
48 }
|