I have an abstract class that a User control inherits from, that I would like to write unit tests for. I understand I need to create a mock class to be able to test abstract classes. The abstract class has references to UI controls (ex: a base method that has web control as an argument). My question is, how would I write unit tests to any methods that references controls in the System.Web.UI namespace?
Thanks
EDIT: Here's an example of the code I have
public abstract SpecialUserControl : System.Web.UI.UserControl
{
protected virtual void DoSomething(TextBox txtBoxName)
{
//Here's the logic I want to write unit test for
}
}
In ascx.cs
public partial class MyUsercontrol : SpecialUserControl
{
protected void Page_Load(object sender, EventArgs e)
{
base.DoSomething( txtBoxName );
}
}
In aspx.cs
public partial class SomePage : BasePage
{
protected void Page_Load(object sender, EventArgs e)
{
//Dynamically loaded
LoadControl("MyUserControl.ascx");
}
}