Description of my project:
I have 2 forms: form 1 and form 2
form 1: is a logging in form that asks for a username and password if entered correctly (exists in my connected to database), form 2 shows and form 1 hides
else a messagebox shows an error message
All the unit tests out there compare actual and expected integer or string results...
so How to test the showing of/ hiding forms and showing message box??
i want to test this function:
private void Loginbtn_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(UsernametextBox.Text))
{
MessageBox.Show("Please enter a Username!");
}
else
{
if (string.IsNullOrEmpty(PasswordtextBox.Text))
{
MessageBox.Show("Please enter a Password!");
}
else
{
if (! Program.myController.Form1LoginButtonPressed(UsernametextBox.Text, PasswordtextBox.Text))
{
MessageBox.Show("error");
}
this.UsernametextBox.Clear();
this.PasswordtextBox.Clear();
}
}
}
thanks in advance