NUnitForms GenericControlTester
In a Windows forms test project using NUnitForms, I was trying to test some DevExpress controls, so I came up with the GenericControlTester for this. It can test any control as long as it inherits System.Windows.Forms.Control.
using System.Windows.Forms;
using NUnit.Extensions.Forms;
public class GenericControlTester<T> : ControlTester where T : Control
{
public GenericControlTester(ControlTester tester, int index) : base(tester, index)
{
}
public GenericControlTester(string name) : base(name)
{
}
public GenericControlTester(string name, Form form) : base(name, form)
{
}
public GenericControlTester(string name, string formName) : base(name, formName)
{
}
new public GenericControlTester<T> this[int index]
{
get { return new GenericControlTester<T>(this, index); }
}
public T Properties
{
get { return (T)Control; }
}
}
Similar Posts
- Unit testing events with anonymous methods
- IEnumerable<> and IEnumerable
- Implicit and Explicit Operators in C#




