Translate

Monday 29 June 2009

Type Inference - NUnit 2.5

//[TestFixture(12.0,42,TypeArgs=new Type[] {typeof(double),typeof(int)})]
[TestFixture("Hello", " World!",TypeArgs=new Type[] {typeof(string),typeof(string)})]
public class TestClass<targ,targ1>
{
private TArg val;
private TArg1 val1;
public TestClass(TArg val, TArg1 val1)
{
this.val = val;
this.val1 = val1;
}
//[TestCase(5.0, 7)]
[TestCase("Hello", " World!")]
public void TestTypesOfArgument(TArg t1, TArg1 t2)
{
Assert.That(val, Is.TypeOf<targ><targ>());
Assert.That(val1, Is.TypeOf<targ><targ>());
}}

Uncomment the commented lines and comment the other attribute to explore and know more!

Happy Testing of Types! :)

No comments: