■ Button
サンプル
ButtonTester buttonTester = new ButtonTester("button1"); // 定義
buttonTester.Click(); // クリック
■ TextBox
サンプル
TextBoxTester textTester = new TextBoxTester("textBox1"); // 定義
Assert.AreEqual(255, textTester["MaxLength"]); // MaxLength [1]
Assert.AreEqual(255, textTester.Properties.MaxLength); // MaxLength [2]
Assert.AreEqual(string.Empty, textTester.Text); // TextBoxの中身を比較
textTester.Enter("aaaa"); // TextBoxに文字入力
Assert.AreEqual("aaaa", textTester.Text); // TextBoxの中身を比較
参考資料
http://nunitforms.sourceforge.net/MSDN/index.htmlhttp://www.atmarkit.co.jp/fdotnet/nagile/nagile03/nagile03_02.html
■ RadioButton
サンプル
RadioButtonTester radioButtonTester1 = new RadioButtonTester("groupBox1.radioButton1"); // 定義
RadioButtonTester radioButtonTester2 = new RadioButtonTester("groupBox1.radioButton2"); // 定義
Assert.IsTrue(radioButtonTester1.Checked); // Checkされているかを確認
Assert.IsFalse(radioButtonTester2.Checked); // Checkされていないかを確認
■ CheckBox
サンプル
CheckBoxTester checkBox1Tester = new CheckBoxTester("checkBox1");
Assert.IsTrue(checkBox1Tester.Properties.Enabled);
Assert.IsFalse(checkBox1Tester.Checked);
checkBox1Tester.Click();
Assert.IsTrue(checkBox1Tester.Checked);