以下は単純な WPF アプリケーションのコードの一部です: 3 つのテキスト ボックス、dropdownList、およびボタン。ボタンをクリックすると、入力値のチェックが行われます。
private void Button_Click_1(object sender, RoutedEventArgs e)
{
if (textBox1.Text.Length>127)
throw new ArgumentException();
if (string.IsNullOrEmpty(textBox2.Text))
errorsList.Add("You must to fill out textbox2");
else if (string.IsNullOrEmpty(textBox3.Text))
errorsList.Add("You must to fill out textbox3");
else if
{
Regex regex = new Regex(@".........");
Match match = regex.Match(emailTxt.Text);
if (!match.Success)
errorsList.Add("e-mail is inlvalid");
}
//.....
}
単体テスト フレームワークを使用してテストする必要があります。ここで単体テストを行うことは可能でしょうか? そうではないと思いますよね?