المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Unit testing



C# Programming
04-08-2009, 11:23 AM
How shud i initialize for test method?

private void button1_Click(object sender, EventArgs e)
{
string choice = txt1.Text;

if (choice == "A")
label1.Text= "You entered a A";
else if (choice == "B")
label1.Text = "You entered a B";
else if (choice == "C")
label1.Text = "You entered a C";
else
label1.Text = "Invalid character";
}

[TestMethod()]
[DeploymentItem("UnitTest.exe")]
public void button1_ClickTest()
{
Form1_Accessor target = new Form1_Accessor(); // TODO: Initialize to an appropriate value
object sender = null; // TODO: Initialize to an appropriate value
EventArgs e = null; // TODO: Initialize to an appropriate value
target.button1_Click(sender, e);
//Assert.Inconclusive("A method that does not return a value cannot be verified.");
}