Tester for System.Web.UI.UserControl
Inheritance: NamingContainerTester
Beispiel #1
0
        protected override void SetUp()
        {
            base.SetUp();

            UserControlTester userControl = new UserControlTester("userControl", CurrentWebForm);

            label = new LabelTester("label", userControl);
            button = new ButtonTester("button", userControl);
            linkButton = new LinkButtonTester("linkButton", userControl);

            clickResult = new LabelTester("clickResult", CurrentWebForm);

            Browser.GetPage(BaseUrl + "AspTester/UserControlTestPage.aspx");
        }
Beispiel #2
0
		public void TestGoToPage2ViaButtoninUserControl() 
		{ 
			// First, instantiate "Tester" objects: 
			UserControlTester myUserControl = new UserControlTester("MyUserControl", CurrentWebForm);
			ButtonTester buttonGoToPage2 = new ButtonTester("GoToPage2", myUserControl); 
			LabelTester labelTester = new LabelTester("LabelPreviousView", CurrentWebForm);

			// Second, visit the page being tested: 
			Browser.GetPage("http://localhost/Castle.MVC.Test.Web/Views/index.aspx"); 
			string loginPage = this.Browser.CurrentUrl.AbsoluteUri.ToString();

			buttonGoToPage2.Click(); 
			string currentPage = this.Browser.CurrentUrl.AbsoluteUri.ToString();
			Assert(currentPage, loginPage != currentPage);
			AssertEquals("index", labelTester.Text); 
		}