public void GetAppSetting1 ()
		{
			PageDelegates pd = new PageDelegates ();
			pd.Load = GetAppSetting1_Load;
			WebTest test = new WebTest (new PageInvoker (pd));
			test.Run ();
		}
示例#2
0
文件: PageInvoker.cs 项目: GirlD/mono
		/// <summary>
		/// Create a new <see cref="PageInvoker"/> which Delegates contain the
		/// given callback for PreInit event.
		/// </summary>
		/// <param name="callback">The user callback.</param>
		/// <returns>A new <see cref="PageInvoker"/> instance.</returns>
		public static PageInvoker CreateOnPreInit (PageDelegate callback)
		{
			PageDelegates pd = new PageDelegates ();
			pd.PreInit = callback;
			PageInvoker pi = new PageInvoker (pd);
			return pi;
		}
示例#3
0
		public void CrossPagePosting_BaseFixture ()
		{
			WebTest t = new WebTest ("CrossPagePosting1.aspx");
			string html = t.Run ();

			if (html.IndexOf ("LinkButtonText") < 0)
				Assert.Fail ("Link button not created fail");

			PageDelegates pd = new PageDelegates ();
			pd.Load = Load;
			t.Invoker = new PageInvoker (pd);

			FormRequest fr = new FormRequest (t.Response, "form1");
			fr.Controls.Add ("__EVENTTARGET");
			fr.Controls.Add ("__EVENTARGUMENT");
			
			fr.Controls["__EVENTTARGET"].Value = "LinkButton1";
			fr.Controls["__EVENTARGUMENT"].Value = "";
			
			t.Request = fr;
			fr.Url = "CrossPagePosting2.aspx";
			html = t.Run ();
			if (html.IndexOf ("CrossedPostbackPage") < 0)
				Assert.Fail ("CrossPagePosting removeing to target page fail");
		}
示例#4
0
文件: PageInvoker.cs 项目: GirlD/mono
		/// <summary>
		/// Create a new <see cref="PageInvoker"/> which Delegates contain the
		/// given callback for Load event.
		/// </summary>
		/// <param name="callback">The user callback.</param>
		/// <returns>A new <see cref="PageInvoker"/> instance.</returns>
		public static PageInvoker CreateOnLoad (PageDelegate callback)
		{
			PageDelegates pd = new PageDelegates ();
			pd.Load = callback;
			PageInvoker pi = new PageInvoker (pd);
			return pi;
		}
示例#5
0
        /// <summary>
        /// Create a new <see cref="PageInvoker"/> which Delegates contain the
        /// given callback for Init event.
        /// </summary>
        /// <param name="callback">The user callback.</param>
        /// <returns>A new <see cref="PageInvoker"/> instance.</returns>
        public static PageInvoker CreateOnInit(PageDelegate callback)
        {
            PageDelegates pd = new PageDelegates();

            pd.Init = callback;
            PageInvoker pi = new PageInvoker(pd);

            return(pi);
        }
		[Category ("NotDotNet")] // for dot-net use __CALLBACKID insted __CALLBACKTARGET and __CALLBACKARGUMENT insted __CALLBACKPARAM
		public void CallBackResulrValues ()
		{
			WebTest t = new WebTest ("CallbackTest1.aspx");
			string html = t.Run ();
			PageDelegates pd = new PageDelegates ();
			pd.Load = Load;
			t.Invoker = new PageInvoker (pd);

			FormRequest fr = new FormRequest (t.Response, "form1");
			fr.Controls.Add ("__EVENTTARGET");
			fr.Controls.Add ("__EVENTARGUMENT");
			fr.Controls.Add ("__CALLBACKTARGET");
			fr.Controls.Add ("__CALLBACKARGUMENT");
			fr.Controls["__EVENTTARGET"].Value = "";
			fr.Controls["__EVENTARGUMENT"].Value = "";
			fr.Controls ["__CALLBACKTARGET"].Value = "__Page";
			fr.Controls ["__CALLBACKARGUMENT"].Value = "monitor";

			t.Request = fr;
			html = t.Run ();
			
			// Into result string the last 2 variables shows if events been done
			// first - RaiseCallbackEvent
			// second - GetCallbackResult

			if (html.IndexOf ("12|true|true") < 0)
				Assert.Fail ("CallBack#1");

			fr.Controls["__EVENTTARGET"].Value = "";
			fr.Controls["__EVENTARGUMENT"].Value = "";
			fr.Controls ["__CALLBACKTARGET"].Value = "__Page";
			fr.Controls ["__CALLBACKARGUMENT"].Value = "laptop";

			t.Request = fr;
			html = t.Run ();

			// Into result string the last 2 variables shows if events been done
			// first - RaiseCallbackEvent
			// second - GetCallbackResult

			if (html.IndexOf ("10|true|true") < 0)
				Assert.Fail ("CallBack#2");
		}
示例#7
0
		public void ListItemsSelectedTest1 ()
		{
			PageDelegates pd = new PageDelegates ();
			pd.Init = ListItemsSelectedTest_Init;
			WebTest test = new WebTest (new PageInvoker (pd));
			string html = test.Run ();
			Assert.IsTrue (html.IndexOf ("selected=") < 0, "ListItemsSelectedTest1 #1");

			test.Request = new FormRequest (test.Response, "form1");
			//test.Invoker = new PageInvoker (pd);
			html = test.Run ();
			Assert.IsTrue (html.IndexOf ("selected=") < 0, "ListItemsSelectedTest1 #2");
		}
		public void FormView_RequiresDataBinding () {
			PageDelegates delegates = new PageDelegates ();
			delegates.LoadComplete = FormView_RequiresDataBinding_LoadComplete;
			PageInvoker invoker = new PageInvoker (delegates);
			WebTest t = new WebTest (invoker);
			t.Run ();
		}
		public void Menu_Templates () {
			PageDelegates pd = new PageDelegates ();
			pd.Init = Menu_Templates_PageInit;
			pd.PreRenderComplete = Menu_Templates_PagePreRenderComplete;
			PageInvoker pi = new PageInvoker (pd);
			new WebTest (pi).Run ();
		}
		public void Menu_PostBackFireEvents_2 ()
		{
			WebTest t = new WebTest ("PostBackMenuTest.aspx");
			PageDelegates pd = new PageDelegates ();
			pd.Init = PostBackFireEvents_Init ;
			t.Invoker = new PageInvoker (pd);
			t.Run ();
			Assert.AreEqual ("MenuItemDataBound", t.UserData.ToString (), "MenuItemDataBound");
		}
		[Category ("NotDotNet")] // implementation specific
		public void Menu_PostBack ()
		{
			PageDelegates pd = new PageDelegates ();
			pd.Init = Menu_SetTableMode;
			WebTest t = new WebTest ("PostBackMenuTest.aspx");
			t.Invoker = new PageInvoker (pd);

			string str = t.Run ();
			FormRequest fr = new FormRequest (t.Response, "form1");
			fr.Controls.Add ("__EVENTTARGET");
			fr.Controls.Add ("__EVENTARGUMENT");
			fr.Controls["__EVENTTARGET"].Value = "Menu1";
			fr.Controls ["__EVENTARGUMENT"].Value = "0_1";
			t.Request = fr;
			pd.PreRender = _MenuItemsPost;
			t.Invoker = new PageInvoker (pd);
			t.Run ();
		}
示例#12
0
		public void InstantiateInContentPlaceHolder_WithPage ()
		{
			WebTest t = new WebTest ("MyPageWithDerivedMaster.aspx");
			var pd = new PageDelegates ();
			pd.Load = InstantiateInContentPlaceHolder_WithPage_Load;
			t.Invoker = new PageInvoker (pd);
			t.Run ();
		}
		public void Wizard_PostBackFireEvents_3 ()
		{
			WebTest t = new WebTest ();
			PageDelegates pd = new PageDelegates ();
			pd.PreInit = _postbackEvents;
			t.Invoker = new PageInvoker (pd);
			string html = t.Run ();
			FormRequest fr = new FormRequest (t.Response, "form1");

			//SideBarButton
			fr = new FormRequest (t.Response, "form1");
			fr.Controls.Add ("__EVENTTARGET");
			fr.Controls.Add ("__EVENTARGUMENT");

			fr.Controls ["__EVENTTARGET"].Value = "Wizard1$SideBarContainer$SideBarList$ctl01$SideBarButton";
			fr.Controls ["__EVENTARGUMENT"].Value = "";
			t.Request = fr;
			html = t.Run ();
			Assert.AreEqual ("SideBarButtonClick", t.UserData.ToString (), "SideBarButton");
		}
示例#14
0
		public void Validation_ValidationGroupNotIncluded () {
			WebTest t = new WebTest ();
			PageDelegates pd = new PageDelegates ();
			pd.Load = Validation_Load;
			pd.PreRender = Validation_PreRender;
			t.Invoker = new PageInvoker (pd);
			t.UserData = "ValidationGroupNotIncluded";
			string html = t.Run ();
			FormRequest fr = new FormRequest (t.Response, "form1");

			fr.Controls.Add ("__EVENTTARGET");
			fr.Controls.Add ("__EVENTARGUMENT");
			fr.Controls ["__EVENTTARGET"].Value = (string) t.UserData;
			fr.Controls ["__EVENTARGUMENT"].Value = "";
			t.Request = fr;
			t.UserData = "ValidationGroupNotIncluded";

			html = t.Run ();
		}
示例#15
0
		public void ListItemsViewState4 ()
		{
			PageDelegates pd = new PageDelegates ();
			pd.Init = ListItemsViewState_Init;
			pd.Load = ListItemsViewState_PageLoad4;
			WebTest test = new WebTest (new PageInvoker (pd));

			string html = test.Run ();
			Assert.IsTrue (html.IndexOf ("value=\"3\"") < 0, "ListItemsViewState4 #1");
			Assert.IsTrue (html.IndexOf ("value=\"heh\"") > 0, "ListItemsViewState4 #2");

			test.Request = new FormRequest (test.Response, "form1");
			html = test.Run ();
			Assert.IsTrue (html.IndexOf ("value=\"2\"") > 0, "ListItemsViewState4 #3");
			Assert.IsTrue (html.IndexOf ("value=\"3\"") < 0, "ListItemsViewState4 #4");
			Assert.IsTrue (html.IndexOf ("value=\"heh\"") > 0, "ListItemsViewState4 #5");
		}
		public void DataBindingDataSourceIDAutomatic () 
		{
			WebTest t = new WebTest ();
			PageDelegates pd = new PageDelegates();
			pd.Load = DataSourceIDAutomatic_Load;
			pd.PreRender = DataSourceIDAutomatic_PreRender;
			t.Invoker = new PageInvoker (pd);

			t.Run ();
		}
示例#17
0
		public void ResolveUrl2 ()
		{
			WebTest t = new WebTest ("ResolveUrl.aspx");
			PageDelegates delegates = new PageDelegates ();
			delegates.Load = ResolveUrl2_Load;
			t.Invoker = new PageInvoker (delegates);
			string html = t.Run ();
		}
示例#18
0
 /// <summary>
 /// The constructor method.
 /// </summary>
 /// <param name="delegates">Value which initializes <see cref="Delegates"/> property.</param>
 /// <seealso cref="Delegates"/>
 public PageInvoker(PageDelegates delegates)
 {
     Delegates = delegates;
 }
		public void Wizard_PostBackFireEvents_2 ()
		{
			WebTest t = new WebTest ();
			PageDelegates pd = new PageDelegates ();
			pd.PreInit = _postbackEvents;
			t.Invoker = new PageInvoker (pd);
			string html = t.Run ();
			FormRequest fr = new FormRequest (t.Response, "form1");

			// Next
			fr.Controls.Add ("__EVENTTARGET");
			fr.Controls.Add ("__EVENTARGUMENT");
			fr.Controls.Add ("Wizard1$StartNavigationTemplateContainerID$StartNextButton");
			fr.Controls["__EVENTTARGET"].Value = "";
			fr.Controls["__EVENTARGUMENT"].Value = "";
			fr.Controls["Wizard1$StartNavigationTemplateContainerID$StartNextButton"].Value = "Next";
			t.Request = fr;
			html = t.Run ();
			Assert.AreEqual ("NextButtonClick", t.UserData.ToString (), "Next");

			// Finish
			fr = new FormRequest (t.Response, "form1");
			fr.Controls.Add ("__EVENTTARGET");
			fr.Controls.Add ("__EVENTARGUMENT");
			fr.Controls.Add ("Wizard1$FinishNavigationTemplateContainerID$FinishButton");
			fr.Controls["__EVENTTARGET"].Value = "";
			fr.Controls["__EVENTARGUMENT"].Value = "";
			fr.Controls["Wizard1$FinishNavigationTemplateContainerID$FinishButton"].Value = "Finish";
			t.Request = fr;
			t.Run ();
			Assert.AreEqual ("FinishButtonClick", t.UserData.ToString (), "Finish");

		}
示例#20
0
		public void ListItemsSelectedTest2 ()
		{
			PageDelegates pd = new PageDelegates ();
			pd.Init = ListItemsSelectedTest_Init;
			pd.Load = ListItemsSelectedTest_Load;
			WebTest test = new WebTest (new PageInvoker (pd));
			string html = test.Run ();
			Assert.IsTrue (html.IndexOf ("selected=") < 0, "ListItemsSelectedTest2 #1");

			test.Request = new FormRequest (test.Response, "form1");
			html = test.Run ();
			Assert.IsTrue (html.IndexOf ("value=\"3\"") > 0, "ListItemsSelectedTest2 #2");
			Assert.IsTrue (html.IndexOf ("selected=") < 0, "ListItemsSelectedTest2 #3");
		}
		public void Wizard_PostBack()
		{
			WebTest t = new WebTest ();
			PageDelegates pd = new PageDelegates ();
			pd.PreInit = _postback;
			pd.PreRenderComplete = _readControl;
			t.Invoker = new PageInvoker (pd);
			string result = t.Run ();
			if (result.IndexOf ("Start") < 0)
				Assert.Fail ("Rendering fault");

			ArrayList list =  t.UserData as ArrayList;
			Assert.IsNotNull (list, "PostBackDataNotCreated");
			
			FormRequest fr = new FormRequest (t.Response, "form1");
			fr.Controls.Add ("__EVENTTARGET");
			fr.Controls.Add ("__EVENTARGUMENT");

			fr.Controls["__EVENTTARGET"].Value = list[1].ToString();
			fr.Controls["__EVENTARGUMENT"].Value = "";
			
			t.Request = fr;
			result = t.Run ();
			if (result.IndexOf ("StepType") < 0)
				Assert.Fail ("MovedToStep1");

			fr = new FormRequest (t.Response, "form1");
			fr.Controls.Add ("__EVENTTARGET");
			fr.Controls.Add ("__EVENTARGUMENT");

			fr.Controls["__EVENTTARGET"].Value = list[2].ToString ();
			fr.Controls["__EVENTARGUMENT"].Value = "";

			t.Request = fr;
			result = t.Run ();
			if (result.IndexOf ("AutoType") < 0)
				Assert.Fail ("MovedToStep2");

			fr = new FormRequest (t.Response, "form1");
			fr.Controls.Add ("__EVENTTARGET");
			fr.Controls.Add ("__EVENTARGUMENT");

			fr.Controls["__EVENTTARGET"].Value = list[3].ToString ();
			fr.Controls["__EVENTARGUMENT"].Value = "";

			t.Request = fr;
			result = t.Run ();
			if (result.IndexOf ("FinishType") < 0)
				Assert.Fail ("MovedToStep3");

			fr = new FormRequest (t.Response, "form1");
			fr.Controls.Add ("__EVENTTARGET");
			fr.Controls.Add ("__EVENTARGUMENT");

			fr.Controls["__EVENTTARGET"].Value = list[4].ToString ();
			fr.Controls["__EVENTARGUMENT"].Value = "";

			t.Request = fr;
			result = t.Run ();
			if (result.IndexOf ("CompleteType") < 0)
				Assert.Fail ("MovedToStep4");
		}
示例#22
0
		public void ListItemsSelectedTest5 ()
		{
			PageDelegates pd = new PageDelegates ();
			pd.Init = ListItemsSelectedTest_Init2;
			pd.Load = ListItemsSelectedTest_Load4;
			WebTest test = new WebTest (new PageInvoker (pd));
			string html = test.Run ();
			Assert.IsTrue (html.IndexOf ("selected=") > 0, "ListItemsSelectedTest5 #1");

			FormRequest fr = new FormRequest (test.Response, "form1");
			fr.Controls.Add ("TestedListBox");
			fr.Controls ["TestedListBox"].Value = "2";
			test.Request = fr;
			test.UserData = "";

			html = test.Run ();
			Assert.IsTrue (html.IndexOf ("value=\"1\"") > 0, "ListItemsSelectedTest5 #2");
			Assert.IsTrue (html.IndexOf ("value=\"2\"") > 0, "ListItemsSelectedTest5 #2");
			Assert.IsTrue (html.IndexOf ("value=\"3\"") > 0, "ListItemsSelectedTest5 #3");
			Assert.IsTrue (html.IndexOf ("selected=") > 0, "ListItemsSelectedTest5 #4");
			Assert.AreEqual ("SelectedIndexChanged", test.UserData, "ListItemsSelectedTest5 #5");
		}
示例#23
0
		public void SessionParameter_Evaluate()
		{
			SessionParameterPoker sessionParam = new SessionParameterPoker("employee",TypeCode.String ,"id") ;
			Button b = new Button();
			string value = (string)sessionParam.DoEvaluate(null, b);
			Assert.AreEqual(null, value, "EvaluateSessionWhenNullContext");
			WebTest t = new WebTest();
			PageDelegates pd = new PageDelegates();
			pd.Init = InitSesssion;
			pd.Load = EvaluateSession;
			t.Invoker = new PageInvoker(pd);
			string html = t.Run();
			WebTest.Unload(); 
			

		}
示例#24
0
		public void BasicPostbackTest ()
		{
			PageInvoker pi = PageInvoker.CreateOnLoad (new PageDelegate (StylesRenderTestInit));
			WebTest test = new WebTest (pi);

			string html = test.Run ();
			test.Invoker = pi;

			FormRequest fr = new FormRequest (test.Response, "form1");

			fr.Controls.Add (new BaseControl (GetDecoratedId (html, "UserName"), "username"));
			fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Password"), "password"));
			fr.Controls.Add (new BaseControl (GetDecoratedId (html, "ConfirmPassword"), "password"));
			fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Email"), "email"));
			fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Question"), "question"));
			fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Answer"), "answer"));

			PageDelegates pd = new PageDelegates ();
			pd.PreRender = new PageDelegate (BasicPostTestPreRender);
			pd.Load = new PageDelegate (StylesRenderTestInit);
			pi.Delegates = pd;

			test.Request = fr;
			html = test.Run ();

			Assert.IsTrue (html.IndexOf ("username") > 0, "rendered user name");
			Assert.IsTrue (html.IndexOf ("password") > 0, "rendered user password");
			Assert.IsTrue (html.IndexOf ("password") > 0, "rendered user confirm password");
			Assert.IsTrue (html.IndexOf ("email") > 0, "rendered user email");
			Assert.IsTrue (html.IndexOf ("question") > 0, "rendered user question");
			Assert.IsTrue (html.IndexOf ("answer") > 0, "rendered user answer");

			Assert.IsTrue (html.IndexOf ("LightGoldenrodYellow;") > 0, "TextBoxStyle");
			Assert.IsTrue (html.LastIndexOf ("LightGoldenrodYellow;") > html.IndexOf ("LightGoldenrodYellow;"), "TextBoxStyle2");
			Assert.IsTrue (html.IndexOf ("732px") > 0, "TitleTextStyle");
			Assert.IsTrue (html.IndexOf ("LightSkyBlue;") > 0, "HyperLinkStyle");
			Assert.IsTrue (html.IndexOf ("MediumSeaGreen;") > 0, "InstructionTextStyle");
			Assert.IsTrue (html.IndexOf ("MediumSpringGreen;") > 0, "LabelStyle");
			Assert.IsTrue (html.IndexOf ("MintCream;") > 0, "PasswordHintStyle");
			Assert.IsTrue (html.IndexOf ("PeachPuff;") > 0, "CreateUserButtonStyle");
		}
		public void Menu_PostBackFireEvents_1 ()
		{
			PageDelegates pd = new PageDelegates ();
			pd.Init = Menu_SetTableMode;
			WebTest t = new WebTest ("PostBackMenuTest.aspx");
			t.Invoker = new PageInvoker (pd);
			
			string str = t.Run ();
			FormRequest fr = new FormRequest (t.Response, "form1");
			fr.Controls.Add ("__EVENTTARGET");
			fr.Controls.Add ("__EVENTARGUMENT");
			fr.Controls["__EVENTTARGET"].Value = "Menu1";
#if DOT_NET
			fr.Controls["__EVENTARGUMENT"].Value = "root";  // "0_1";
#else
			fr.Controls ["__EVENTARGUMENT"].Value = "0";  // "0_1";
#endif
			t.Request = fr;
			str = t.Run ();
			Assert.AreEqual ("MenuItemClick", t.UserData.ToString (), "PostBackEvent");
		}
		public void ImageField_GetFormattedAlternateText ()
		{
			WebTest t = new WebTest ();
			PageDelegates pd = new PageDelegates ();
			pd.PreRender = _ImageFieldInit;
			t.Invoker = new PageInvoker (pd);
			
			string htmlPage = t.Run ();
#if NET_4_0
			string htmlOrigin = "<div>\r\n\t<table cellspacing=\"0\" rules=\"all\" border=\"1\" id=\"Grid\" style=\"border-collapse:collapse;\">\r\n\t\t<tr>\r\n\t\t\t<th scope=\"col\">Data</th>\r\n\t\t</tr><tr>\r\n\t\t\t<td><img src=\"Item%200\" alt=\"Item: Item 0\" /></td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><img src=\"Item%201\" alt=\"Item: Item 1\" /></td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><img src=\"Item%202\" alt=\"Item: Item 2\" /></td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><img src=\"Item%203\" alt=\"Item: Item 3\" /></td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><img src=\"Item%204\" alt=\"Item: Item 4\" /></td>\r\n\t\t</tr>\r\n\t</table>\r\n</div>";
#else
			string htmlOrigin = "<div>\r\n\t<table cellspacing=\"0\" rules=\"all\" border=\"1\" id=\"Grid\" style=\"border-collapse:collapse;\">\r\n\t\t<tr>\r\n\t\t\t<th scope=\"col\">Data</th>\r\n\t\t</tr><tr>\r\n\t\t\t<td><img src=\"Item%200\" alt=\"Item: Item 0\" style=\"border-width:0px;\" /></td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><img src=\"Item%201\" alt=\"Item: Item 1\" style=\"border-width:0px;\" /></td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><img src=\"Item%202\" alt=\"Item: Item 2\" style=\"border-width:0px;\" /></td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><img src=\"Item%203\" alt=\"Item: Item 3\" style=\"border-width:0px;\" /></td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><img src=\"Item%204\" alt=\"Item: Item 4\" style=\"border-width:0px;\" /></td>\r\n\t\t</tr>\r\n\t</table>\r\n</div>";
#endif
			string htmlControl = HtmlDiff.GetControlFromPageHtml (htmlPage);
			HtmlDiff.AssertAreEqual (htmlOrigin, htmlControl, "GetFormattedAlternateText");
		}
		public void Menu_DataBindByDataSourceID () {
			PageDelegates pd = new PageDelegates ();
			pd.Init = Menu_DataBindByDataSourceID_PageInit;
			pd.PreRenderComplete = Menu_DataBindByDataSourceID_PagePreRenderComplete;
			PageInvoker pi = new PageInvoker (pd);
			new WebTest (pi).Run ();
		}
		public void ImageField_NullDisplayText ()
		{
			WebTest t = new WebTest ();
			PageDelegates pd = new PageDelegates ();
			pd.PreRender = _ImageFieldNullText;
			t.Invoker = new PageInvoker (pd);

			string htmlPage = t.Run ();
			string htmlOrigin = "<div>\r\n\t<table cellspacing=\"0\" rules=\"all\" border=\"1\" style=\"border-collapse:collapse;\">\r\n\t\t<tr>\r\n\t\t\t<th scope=\"col\">Data</th><th scope=\"col\">Field</th>\r\n\t\t</tr><tr>\r\n\t\t\t<td><span>NullDisplayText</span></td><td>&nbsp;</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><span>NullDisplayText</span></td><td>&nbsp;</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><span>NullDisplayText</span></td><td>&nbsp;</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><span>NullDisplayText</span></td><td>&nbsp;</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><span>NullDisplayText</span></td><td>&nbsp;</td>\r\n\t\t</tr>\r\n\t</table>\r\n</div>";
			string htmlControl = HtmlDiff.GetControlFromPageHtml (htmlPage);
			HtmlDiff.AssertAreEqual (htmlOrigin, htmlControl, "ImageFieldNullText");
		}
		public void FormView_DataSourceChangedEvent ()
		{
			WebTest t = new WebTest();
			PageDelegates pd = new PageDelegates ();
			pd.Load = FormView_Init;
			pd.PreRenderComplete = FormView_Load;
			t.Invoker = new PageInvoker (pd);
			t.Run ();
			FormRequest fr = new FormRequest (t.Response, "form1");
			fr.Controls.Add ("__EVENTTARGET");
			fr.Controls.Add ("__EVENTARGUMENT");
			fr.Controls["__EVENTTARGET"].Value = "";
			fr.Controls["__EVENTARGUMENT"].Value = "";
			t.Request = fr;
			t.Run ();
			if (t.UserData == null)
				Assert.Fail ("DataSourceChangedEvent#1");
			Assert.AreEqual ("Data_rebounded", t.UserData.ToString (), "DataSourceChangedEvent#2");
		}
		public void ImageField_ConvertEmptyStringToNull ()
		{
			WebTest t = new WebTest ();
			PageDelegates pd = new PageDelegates ();
			pd.PreRender = _ConvertEmptyStringToNull;
			t.Invoker = new PageInvoker (pd);
			string htmlPage = t.Run ();
#if NET_4_0
			string htmlOrigin = "<div>\r\n\t<table cellspacing=\"0\" rules=\"all\" border=\"1\" style=\"border-collapse:collapse;\">\r\n\t\t<tr>\r\n\t\t\t<th scope=\"col\">Data</th><th scope=\"col\">Field</th>\r\n\t\t</tr><tr>\r\n\t\t\t<td><img src=\"\" /></td><td>&nbsp;</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><img src=\"\" /></td><td>&nbsp;</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><img src=\"\" /></td><td>&nbsp;</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><img src=\"\" /></td><td>&nbsp;</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><img src=\"\" /></td><td>&nbsp;</td>\r\n\t\t</tr>\r\n\t</table>\r\n</div>";
#else
			string htmlOrigin = "<div>\r\n\t<table cellspacing=\"0\" rules=\"all\" border=\"1\" style=\"border-collapse:collapse;\">\r\n\t\t<tr>\r\n\t\t\t<th scope=\"col\">Data</th><th scope=\"col\">Field</th>\r\n\t\t</tr><tr>\r\n\t\t\t<td><img src=\"\" style=\"border-width:0px;\" /></td><td>&nbsp;</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><img src=\"\" style=\"border-width:0px;\" /></td><td>&nbsp;</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><img src=\"\" style=\"border-width:0px;\" /></td><td>&nbsp;</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><img src=\"\" style=\"border-width:0px;\" /></td><td>&nbsp;</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><img src=\"\" style=\"border-width:0px;\" /></td><td>&nbsp;</td>\r\n\t\t</tr>\r\n\t</table>\r\n</div>";
#endif
			string htmlControl = HtmlDiff.GetControlFromPageHtml (htmlPage);
			HtmlDiff.AssertAreEqual (htmlOrigin, htmlControl, "ConvertEmptyStringToNull");
		}
		public void FormView_PageIndex2 ()
		{
			PageDelegates delegates = new PageDelegates ();
			delegates.Load = FormView_PageIndex2_load;
			delegates.LoadComplete = FormView_PageIndex2_loadComplete;
			PageInvoker invoker = new PageInvoker (delegates);
			WebTest test = new WebTest (invoker);
			test.Run ();
		}
示例#32
0
		public void TemplateControl_Eval ()
		{
			// In this test aspx page used as template control
			WebTest.CopyResource (GetType (), "EvalTest.aspx", "EvalTest.aspx");
			WebTest t = new WebTest ("EvalTest.aspx");
			PageDelegates pd = new PageDelegates ();
			pd.PreRender = _templatePreRender;
			t.Invoker = new PageInvoker (pd);
			t.Run ();
			string html = t.Run ();
			if (html.IndexOf ("My databind test") < 0)
				Assert.Fail ("Eval not done fail");
		}