comparison HowTo/Aspects/OverloadAspect.cs @ 0:f990fcb411a9

Копия текущей версии из github
author cin
date Thu, 27 Mar 2014 21:46:09 +0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f990fcb411a9
1 using NUnit.Framework;
2
3 using BLToolkit.Aspects;
4 using BLToolkit.Reflection;
5
6 namespace HowTo.Aspects
7 {
8 public /*[a]*/abstract/*[/a]*/ class OverloadTestObject
9 {
10 // This is a member we will overload.
11 //
12 public int /*[a]*/Test/*[/a]*/(/*[a]*/int intVal, string strVal/*[/a]*/)
13 {
14 return intVal;
15 }
16
17 // Overloaded methods simply calls a base method with same name
18 // and has a few parameters less or more.
19 //
20 [/*[a]*/Overload/*[/a]*/] public abstract int /*[a]*/Test/*[/a]*/(/*[a]*/int intVal/*[/a]*/);
21 [/*[a]*/Overload/*[/a]*/] public abstract int /*[a]*/Test/*[/a]*/(/*[a]*/string strVal/*[/a]*/);
22 [/*[a]*/Overload/*[/a]*/] public abstract int /*[a]*/Test/*[/a]*/(int intVal, string strVal, /*[a]*/bool boolVal/*[/a]*/);
23 }
24
25 [TestFixture]
26 public class OverloadAspectTest
27 {
28 [Test]
29 public void OverloadTest()
30 {
31 OverloadTestObject o = /*[a]*/TypeAccessor/*[/a]*/<OverloadTestObject>.CreateInstance();
32
33 Assert.AreEqual(1, o./*[a]*/Test/*[/a]*/(1));
34 Assert.AreEqual(0, o./*[a]*/Test/*[/a]*/("str"));
35 }
36 }
37 }