code_junkie

How to write Unit Tests for Web Applications and Controls

Nov 12th, 2011
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. [Test]
  2. public void TestExample()
  3. {
  4. // First, instantiate "Tester" objects:
  5. LabelTester label = new LabelTester("textLabel");
  6. LinkButtonTester link = new LinkButtonTester("linkButton");
  7.  
  8. // Second, visit the page being tested:
  9. Browser.GetPage("http://localhost/example/example.aspx");
  10.  
  11. // Third, use tester objects to test the page:
  12. Assert.AreEqual("Not clicked.", label.Text);
  13. link.Click();
  14. Assert.AreEqual("Clicked once.", label.Text);
  15. link.Click();
  16. Assert.AreEqual("Clicked twice.", label.Text);
  17. }
Add Comment
Please, Sign In to add comment