view HowTo/Aspects/OverloadAspect.cs @ 3:1ef98bd70424

!bug 100 +3h Исправление проблемы BLToolkit + mono 3.4
author cin
date Fri, 22 Aug 2014 17:34:46 +0400
parents f990fcb411a9
children
line wrap: on
line source

using NUnit.Framework;

using BLToolkit.Aspects;
using BLToolkit.Reflection;

namespace HowTo.Aspects
{
	public /*[a]*/abstract/*[/a]*/ class OverloadTestObject
	{
		// This is a member we will overload.
		//
		public int /*[a]*/Test/*[/a]*/(/*[a]*/int intVal, string strVal/*[/a]*/)
		{
			return intVal;
		}

		// Overloaded methods simply calls a base method with same name
		// and has a few parameters less or more.
		//
		[/*[a]*/Overload/*[/a]*/] public abstract int /*[a]*/Test/*[/a]*/(/*[a]*/int intVal/*[/a]*/);
		[/*[a]*/Overload/*[/a]*/] public abstract int /*[a]*/Test/*[/a]*/(/*[a]*/string strVal/*[/a]*/);
		[/*[a]*/Overload/*[/a]*/] public abstract int /*[a]*/Test/*[/a]*/(int intVal, string strVal, /*[a]*/bool boolVal/*[/a]*/);
	}

	[TestFixture]
	public class OverloadAspectTest
	{
		[Test]
		public void OverloadTest()
		{
			OverloadTestObject o = /*[a]*/TypeAccessor/*[/a]*/<OverloadTestObject>.CreateInstance();

			Assert.AreEqual(1, o./*[a]*/Test/*[/a]*/(1));
			Assert.AreEqual(0, o./*[a]*/Test/*[/a]*/("str"));
		}
	}
}