本文整理汇总了C#中MonoTests.SystemWeb.Framework.FormRequest类的典型用法代码示例。如果您正苦于以下问题:C# FormRequest类的具体用法?C# FormRequest怎么用?C# FormRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FormRequest类属于MonoTests.SystemWeb.Framework命名空间,在下文中一共展示了FormRequest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: StateFormatter_CollectionFormatter
public void StateFormatter_CollectionFormatter ()
{
WebTest t = new WebTest ("StateFormatter_CollectionConverter.aspx");
t.Run ();
var fr = new FormRequest (t.Response, "form1");
fr.Controls.Add ("btnSearch");
fr.Controls.Add ("ddlDate");
fr.Controls.Add ("txtSearchValue");
fr.Controls ["btnSearch"].Value = "Search";
fr.Controls ["ddlDate"].Value = "2009";
t.Request = fr;
string pageHtml = t.Run ();
string renderedHtml = HtmlDiff.GetControlFromPageHtml (pageHtml);
string originalHtml = @"<div>
<table id=""gvECCN"" cellspacing=""0"" rules=""all"" border=""1"" style=""border-collapse:collapse;"">
<tr>
<th align=""left"" scope=""col""> </th><th align=""left"" scope=""col"">Schedule B</th><th align=""left"" scope=""col"">Count</th><th align=""left"" scope=""col"">Total</th><th align=""left"" scope=""col"">Percent</th>
</tr><tr>
<td style=""height:18px;width:30px;"">1</td><td style=""width:140px;"">test</td><td style=""width:90px;"">1</td><td style=""width:100px;"">100</td><td style=""width:90px;"">250.00 %</td>
</tr>
</table>
</div>";
HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "#A1");
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:30,代码来源:ObjectStateFormatterTest.cs
示例2: CrossPagePosting_BaseFixture
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");
}
开发者ID:Profit0004,项目名称:mono,代码行数:25,代码来源:CrossPagePostingTest.cs
示例3: StateFormatter_CorrectConverter
public void StateFormatter_CorrectConverter ()
{
// We test only if it doesn't throw exception on postback
WebTest t = new WebTest ("StateFormatter_CorrectConverter.aspx");
t.Run ();
var fr = new FormRequest (t.Response, "Form1");
fr.Controls.Add ("Button1");
fr.Controls ["Button1"].Value = "Change";
t.Request = fr;
t.Run ();
fr = new FormRequest (t.Response, "Form1");
fr.Controls.Add ("Button2");
fr.Controls ["Button2"].Value = "Refresh";
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:16,代码来源:ObjectStateFormatterTest.cs
示例4: CallBackResulrValues
[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");
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:44,代码来源:CallBackTest.cs
示例5: StateFormatter_CorrectConverter
public void StateFormatter_CorrectConverter ()
{
// We test only if it doesn't throw exception on postback
try {
WebTest.Host.AppDomain.AssemblyResolve += new ResolveEventHandler (ResolveAssemblyHandler);
WebTest t = new WebTest ("StateFormatter_CorrectConverter.aspx");
t.Run ();
var fr = new FormRequest (t.Response, "Form1");
fr.Controls.Add ("Button1");
fr.Controls ["Button1"].Value = "Change";
t.Request = fr;
t.Run ();
fr = new FormRequest (t.Response, "Form1");
fr.Controls.Add ("Button2");
fr.Controls ["Button2"].Value = "Refresh";
} finally {
WebTest.Host.AppDomain.AssemblyResolve -= new ResolveEventHandler (ResolveAssemblyHandler);
}
}
开发者ID:nobled,项目名称:mono,代码行数:21,代码来源:ObjectStateFormatterTest.cs
示例6: DetailsView_EditPostback
public void DetailsView_EditPostback ()
{
WebTest t = new WebTest ("DetailsViewDataActions.aspx");
t.Invoker = PageInvoker.CreateOnLoad (EditPostback_Load);
string pageHTML = t.Run ();
Assert.AreEqual (true, pageHTML.Contains ("Edit"), "BeforeEditPostback");
FormRequest fr = new FormRequest (t.Response, "form1");
fr.Controls.Add ("__EVENTTARGET");
fr.Controls.Add ("__EVENTARGUMENT");
fr.Controls["__EVENTTARGET"].Value = "DetailsView1";
fr.Controls["__EVENTARGUMENT"].Value = "Edit$0";
t.Request = fr;
pageHTML = t.Run ();
string renderedHtml = HtmlDiff.GetControlFromPageHtml (pageHTML);
#if NET_4_0
string origHtmlValue = "<div>\r\n\t<table cellspacing=\"0\" rules=\"all\" border=\"1\" id=\"DetailsView1\" style=\"height:50px;width:125px;border-collapse:collapse;\">\r\n\t\t<tr>\r\n\t\t\t<td>ID</td><td>1001</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td>FName</td><td><input name=\"DetailsView1$ctl01\" type=\"text\" value=\"Mahesh\" title=\"FName\" /></td>\r\n\t\t</tr><tr>\r\n\t\t\t<td>LName</td><td><input name=\"DetailsView1$ctl02\" type=\"text\" value=\"Chand\" title=\"LName\" /></td>\r\n\t\t</tr><tr>\r\n\t\t\t<td colspan=\"2\"><a href=\"javascript:__doPostBack('DetailsView1$ctl03','')\">Update</a> <a href=\"javascript:__doPostBack('DetailsView1','Cancel$0')\">Cancel</a></td>\r\n\t\t</tr><tr>\r\n\t\t\t<td colspan=\"2\"><table>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td><span>1</span></td><td><a href=\"javascript:__doPostBack('DetailsView1','Page$2')\">2</a></td><td><a href=\"javascript:__doPostBack('DetailsView1','Page$3')\">3</a></td>\r\n\t\t\t\t</tr>\r\n\t\t\t</table></td>\r\n\t\t</tr>\r\n\t</table>\r\n</div>";
#else
string origHtmlValue = "<div>\r\n\t<table cellspacing=\"0\" rules=\"all\" border=\"1\" id=\"DetailsView1\" style=\"height:50px;width:125px;border-collapse:collapse;\">\r\n\t\t<tr>\r\n\t\t\t<td>ID</td><td>1001</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td>FName</td><td><input name=\"DetailsView1$ctl01\" type=\"text\" value=\"Mahesh\" title=\"FName\" /></td>\r\n\t\t</tr><tr>\r\n\t\t\t<td>LName</td><td><input name=\"DetailsView1$ctl02\" type=\"text\" value=\"Chand\" title=\"LName\" /></td>\r\n\t\t</tr><tr>\r\n\t\t\t<td colspan=\"2\"><a href=\"javascript:__doPostBack('DetailsView1$ctl03','')\">Update</a> <a href=\"javascript:__doPostBack('DetailsView1','Cancel$0')\">Cancel</a></td>\r\n\t\t</tr><tr>\r\n\t\t\t<td colspan=\"2\"><table border=\"0\">\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td><span>1</span></td><td><a href=\"javascript:__doPostBack('DetailsView1','Page$2')\">2</a></td><td><a href=\"javascript:__doPostBack('DetailsView1','Page$3')\">3</a></td>\r\n\t\t\t\t</tr>\r\n\t\t\t</table></td>\r\n\t\t</tr>\r\n\t</table>\r\n</div>";
#endif
HtmlDiff.AssertAreEqual (origHtmlValue, renderedHtml, "AfterEditPostback");
// Checking for change mode event fired.
ArrayList eventlist = t.UserData as ArrayList;
if (eventlist == null)
Assert.Fail ("User data does not been created fail");
Assert.AreEqual ("ModeChanging", eventlist[0], "#1");
Assert.AreEqual ("ModeChanged", eventlist[1], "#2");
}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:28,代码来源:DetailsViewTest.cs
示例7: DetailsView_DeletePostback
public void DetailsView_DeletePostback ()
{
WebTest t = new WebTest ("DetailsViewDataActions.aspx");
t.Invoker = PageInvoker.CreateOnLoad (DeletePostback_Load);
string pageHTML = t.Run ();
Assert.AreEqual (true, pageHTML.Contains ("1001"), "BeforeDeletePostback");
FormRequest fr = new FormRequest (t.Response, "form1");
fr.Controls.Add ("__EVENTTARGET");
fr.Controls.Add ("__EVENTARGUMENT");
fr.Controls["__EVENTTARGET"].Value = "DetailsView1";
fr.Controls["__EVENTARGUMENT"].Value = "Delete$0";
t.Request = fr;
pageHTML = t.Run ();
//Console.WriteLine ("XXXXFAIL {0}", pageHTML);
string renderedHtml = HtmlDiff.GetControlFromPageHtml (pageHTML);
#if NET_4_0
string origHtmlValue = "<div>\r\n\t<table cellspacing=\"0\" rules=\"all\" border=\"1\" id=\"DetailsView1\" style=\"height:50px;width:125px;border-collapse:collapse;\">\r\n\t\t<tr>\r\n\t\t\t<td>ID</td><td>1002</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td>FName</td><td>Melanie</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td>LName</td><td>Talmadge</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td colspan=\"2\"><a href=\"javascript:__doPostBack('DetailsView1','Edit$0')\">Edit</a> <a href=\"javascript:__doPostBack('DetailsView1','Delete$0')\">Delete</a> <a href=\"javascript:__doPostBack('DetailsView1','New$0')\">New</a></td>\r\n\t\t</tr><tr>\r\n\t\t\t<td colspan=\"2\"><table>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td><span>1</span></td><td><a href=\"javascript:__doPostBack('DetailsView1','Page$2')\">2</a></td>\r\n\t\t\t\t</tr>\r\n\t\t\t</table></td>\r\n\t\t</tr>\r\n\t</table>\r\n</div>";
#else
string origHtmlValue = "<div>\r\n\t<table cellspacing=\"0\" rules=\"all\" border=\"1\" id=\"DetailsView1\" style=\"height:50px;width:125px;border-collapse:collapse;\">\r\n\t\t<tr>\r\n\t\t\t<td>ID</td><td>1002</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td>FName</td><td>Melanie</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td>LName</td><td>Talmadge</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td colspan=\"2\"><a href=\"javascript:__doPostBack('DetailsView1','Edit$0')\">Edit</a> <a href=\"javascript:__doPostBack('DetailsView1','Delete$0')\">Delete</a> <a href=\"javascript:__doPostBack('DetailsView1','New$0')\">New</a></td>\r\n\t\t</tr><tr>\r\n\t\t\t<td colspan=\"2\"><table border=\"0\">\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td><span>1</span></td><td><a href=\"javascript:__doPostBack('DetailsView1','Page$2')\">2</a></td>\r\n\t\t\t\t</tr>\r\n\t\t\t</table></td>\r\n\t\t</tr>\r\n\t</table>\r\n</div>";
#endif
HtmlDiff.AssertAreEqual (origHtmlValue, renderedHtml, "DeleteDataPostback");
Assert.AreEqual (false, renderedHtml.Contains ("1001"), "AfterDeletePostback");
// Checking for delete event fired.
ArrayList eventlist = t.UserData as ArrayList;
if (eventlist == null)
Assert.Fail ("User data does not been created fail");
Assert.AreEqual ("ItemDeleting", eventlist[0], "#1");
Assert.AreEqual ("ItemDeleted", eventlist[1], "#2");
}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:32,代码来源:DetailsViewTest.cs
示例8: Menu_PostBackFireEvents_1
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");
}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:21,代码来源:MenuTest.cs
示例9: MultiView_Events_SwitchViewByIndex_PostBack
public void MultiView_Events_SwitchViewByIndex_PostBack ()
{
WebTest t = new WebTest ("NoEventValidation.aspx");
t.Invoker = PageInvoker.CreateOnInit (new PageDelegate (EventsTest_4));
string html = t.Run ();
if (html.IndexOf ("View_1_is_active") < 0)
Assert.Fail ("MultiView_Events#1 Failed");
FormRequest fr = new FormRequest (t.Response, "form1");
fr.Controls.Add ("bt");
fr.Controls["bt"].Value = "Button";
t.Request = fr;
html = t.Run ();
if (html.IndexOf ("ActiveViewChangedFired") < 0) {
Assert.Fail ("MultiView_Events#3 Failed");
}
if (html.IndexOf ("View_2_is_active") < 0)
Assert.Fail ("MultiView_Events#4 Failed");
}
开发者ID:nobled,项目名称:mono,代码行数:21,代码来源:MultiViewTest.cs
示例10: FormView_EditPostback
public void FormView_EditPostback ()
{
WebTest t = new WebTest ("FormViewInsertEditDelete.aspx");
string pageHTML = t.Run ();
string newHtml = HtmlDiff.GetControlFromPageHtml (pageHTML);
#if NET_4_0
string origHtml = "<table cellspacing=\"0\" id=\"FormView1\" style=\"border-collapse:collapse;\">\r\n\t<tr>\r\n\t\t<td colspan=\"2\">\n <span id=\"FormView1_ID\">1001</span> \n <span id=\"FormView1_LName\">Chand</span>\n <span id=\"FormView1_FName\">Mahesh</span> \n <a id=\"FormView1_EditButton\" href=\"javascript:__doPostBack('FormView1$EditButton','')\">Edit</a>\n <a id=\"FormView1_NewButton\" href=\"javascript:__doPostBack('FormView1$NewButton','')\">New</a>\n <a id=\"FormView1_DeleteButton\" href=\"javascript:__doPostBack('FormView1$DeleteButton','')\">Delete</a>\n </td>\r\n\t</tr><tr>\r\n\t\t<td colspan=\"2\"><table>\r\n\t\t\t<tr>\r\n\t\t\t\t<td><span>1</span></td><td><a href=\"javascript:__doPostBack('FormView1','Page$2')\">2</a></td><td><a href=\"javascript:__doPostBack('FormView1','Page$3')\">3</a></td>\r\n\t\t\t</tr>\r\n\t\t</table></td>\r\n\t</tr>\r\n</table>";
#else
string origHtml = "<table cellspacing=\"0\" border=\"0\" id=\"FormView1\" style=\"border-collapse:collapse;\">\r\n\t<tr>\r\n\t\t<td colspan=\"2\">\n <span id=\"FormView1_ID\">1001</span> \n <span id=\"FormView1_LName\">Chand</span>\n <span id=\"FormView1_FName\">Mahesh</span> \n <a id=\"FormView1_EditButton\" href=\"javascript:__doPostBack('FormView1$EditButton','')\">Edit</a>\n <a id=\"FormView1_NewButton\" href=\"javascript:__doPostBack('FormView1$NewButton','')\">New</a>\n <a id=\"FormView1_DeleteButton\" href=\"javascript:__doPostBack('FormView1$DeleteButton','')\">Delete</a>\n </td>\r\n\t</tr><tr>\r\n\t\t<td colspan=\"2\"><table border=\"0\">\r\n\t\t\t<tr>\r\n\t\t\t\t<td><span>1</span></td><td><a href=\"javascript:__doPostBack('FormView1','Page$2')\">2</a></td><td><a href=\"javascript:__doPostBack('FormView1','Page$3')\">3</a></td>\r\n\t\t\t</tr>\r\n\t\t</table></td>\r\n\t</tr>\r\n</table>";
#endif
HtmlDiff.AssertAreEqual (origHtml, newHtml, "BeforeEditPostback");
//Edit button postback (change to edit mode - buttons "Update" and "Cancel" should appear.
FormRequest fr = new FormRequest (t.Response, "form1");
fr.Controls.Add ("__EVENTTARGET");
fr.Controls.Add ("__EVENTARGUMENT");
fr.Controls["__EVENTTARGET"].Value = "FormView1$EditButton";
fr.Controls["__EVENTARGUMENT"].Value = "";
t.Request = fr;
pageHTML = t.Run ();
newHtml = HtmlDiff.GetControlFromPageHtml (pageHTML);
#if NET_4_0
origHtml = "<table cellspacing=\"0\" id=\"FormView1\" style=\"border-collapse:collapse;\">\r\n\t<tr>\r\n\t\t<td colspan=\"2\">\n Enter First Name:<input name=\"FormView1$FNameEdit\" type=\"text\" value=\"Mahesh\" id=\"FormView1_FNameEdit\" /><br />\n Enter Last Name:<input name=\"FormView1$LNameEdit\" type=\"text\" value=\"Chand\" id=\"FormView1_LNameEdit\" /><br />\n <a id=\"FormView1_UpdateButton\" href=\"javascript:__doPostBack('FormView1$UpdateButton','')\">Update</a>\n <a id=\"FormView1_CancelUpdateButton\" href=\"javascript:__doPostBack('FormView1$CancelUpdateButton','')\">Cancel</a>\n </td>\r\n\t</tr><tr>\r\n\t\t<td colspan=\"2\"><table>\r\n\t\t\t<tr>\r\n\t\t\t\t<td><span>1</span></td><td><a href=\"javascript:__doPostBack('FormView1','Page$2')\">2</a></td><td><a href=\"javascript:__doPostBack('FormView1','Page$3')\">3</a></td>\r\n\t\t\t</tr>\r\n\t\t</table></td>\r\n\t</tr>\r\n</table>";
#else
origHtml = "<table cellspacing=\"0\" border=\"0\" id=\"FormView1\" style=\"border-collapse:collapse;\">\r\n\t<tr>\r\n\t\t<td colspan=\"2\">\n Enter First Name:<input name=\"FormView1$FNameEdit\" type=\"text\" value=\"Mahesh\" id=\"FormView1_FNameEdit\" /><br />\n Enter Last Name:<input name=\"FormView1$LNameEdit\" type=\"text\" value=\"Chand\" id=\"FormView1_LNameEdit\" /><br />\n <a id=\"FormView1_UpdateButton\" href=\"javascript:__doPostBack('FormView1$UpdateButton','')\">Update</a>\n <a id=\"FormView1_CancelUpdateButton\" href=\"javascript:__doPostBack('FormView1$CancelUpdateButton','')\">Cancel</a>\n </td>\r\n\t</tr><tr>\r\n\t\t<td colspan=\"2\"><table border=\"0\">\r\n\t\t\t<tr>\r\n\t\t\t\t<td><span>1</span></td><td><a href=\"javascript:__doPostBack('FormView1','Page$2')\">2</a></td><td><a href=\"javascript:__doPostBack('FormView1','Page$3')\">3</a></td>\r\n\t\t\t</tr>\r\n\t\t</table></td>\r\n\t</tr>\r\n</table>";
#endif
HtmlDiff.AssertAreEqual (origHtml, newHtml, "AfterEditPostback");
//Update record postback
fr = new FormRequest (t.Response, "form1");
fr.Controls.Add ("__EVENTTARGET");
fr.Controls.Add ("__EVENTARGUMENT");
fr.Controls.Add ("FormView1$FNameEdit");
fr.Controls.Add ("FormView1$LNameEdit");
fr.Controls["__EVENTTARGET"].Value = "FormView1$UpdateButton";
fr.Controls["__EVENTARGUMENT"].Value = "";
fr.Controls["FormView1$FNameEdit"].Value = "Merav";
fr.Controls["FormView1$LNameEdit"].Value = "Test";
t.Request = fr;
pageHTML = t.Run ();
newHtml = HtmlDiff.GetControlFromPageHtml (pageHTML);
#if NET_4_0
origHtml = "<table cellspacing=\"0\" id=\"FormView1\" style=\"border-collapse:collapse;\">\r\n\t<tr>\r\n\t\t<td colspan=\"2\">\n <span id=\"FormView1_ID\">1001</span> \n <span id=\"FormView1_LName\">Test</span>\n <span id=\"FormView1_FName\">Merav</span> \n <a id=\"FormView1_EditButton\" href=\"javascript:__doPostBack('FormView1$EditButton','')\">Edit</a>\n <a id=\"FormView1_NewButton\" href=\"javascript:__doPostBack('FormView1$NewButton','')\">New</a>\n <a id=\"FormView1_DeleteButton\" href=\"javascript:__doPostBack('FormView1$DeleteButton','')\">Delete</a>\n </td>\r\n\t</tr><tr>\r\n\t\t<td colspan=\"2\"><table>\r\n\t\t\t<tr>\r\n\t\t\t\t<td><span>1</span></td><td><a href=\"javascript:__doPostBack('FormView1','Page$2')\">2</a></td><td><a href=\"javascript:__doPostBack('FormView1','Page$3')\">3</a></td>\r\n\t\t\t</tr>\r\n\t\t</table></td>\r\n\t</tr>\r\n</table>";
#else
origHtml = "<table cellspacing=\"0\" border=\"0\" id=\"FormView1\" style=\"border-collapse:collapse;\">\r\n\t<tr>\r\n\t\t<td colspan=\"2\">\n <span id=\"FormView1_ID\">1001</span> \n <span id=\"FormView1_LName\">Test</span>\n <span id=\"FormView1_FName\">Merav</span> \n <a id=\"FormView1_EditButton\" href=\"javascript:__doPostBack('FormView1$EditButton','')\">Edit</a>\n <a id=\"FormView1_NewButton\" href=\"javascript:__doPostBack('FormView1$NewButton','')\">New</a>\n <a id=\"FormView1_DeleteButton\" href=\"javascript:__doPostBack('FormView1$DeleteButton','')\">Delete</a>\n </td>\r\n\t</tr><tr>\r\n\t\t<td colspan=\"2\"><table border=\"0\">\r\n\t\t\t<tr>\r\n\t\t\t\t<td><span>1</span></td><td><a href=\"javascript:__doPostBack('FormView1','Page$2')\">2</a></td><td><a href=\"javascript:__doPostBack('FormView1','Page$3')\">3</a></td>\r\n\t\t\t</tr>\r\n\t\t</table></td>\r\n\t</tr>\r\n</table>";
#endif
HtmlDiff.AssertAreEqual (origHtml, newHtml, "AfterUpdatePostback");
//Postback to return to Edit mode
fr = new FormRequest (t.Response, "form1");
fr.Controls.Add ("__EVENTTARGET");
fr.Controls.Add ("__EVENTARGUMENT");
fr.Controls["__EVENTTARGET"].Value = "FormView1$EditButton";
fr.Controls["__EVENTARGUMENT"].Value = "";
t.Request = fr;
pageHTML = t.Run ();
newHtml = pageHTML.Substring (pageHTML.IndexOf ("start") + 5, pageHTML.IndexOf ("end") - pageHTML.IndexOf ("start") - 5);
Assert.AreEqual (true, pageHTML.Contains ("Merav"), "EditModePostback1");
Assert.AreEqual (true, pageHTML.Contains ("CancelUpdateButton"), "EditModePostback2");
// Cancel edited record postback
fr = new FormRequest (t.Response, "form1");
fr.Controls.Add ("__EVENTTARGET");
fr.Controls.Add ("__EVENTARGUMENT");
fr.Controls.Add ("FormView1$FNameEdit");
fr.Controls.Add ("FormView1$LNameEdit");
fr.Controls["FormView1$FNameEdit"].Value = "EditFirstName";
fr.Controls["FormView1$LNameEdit"].Value = "EditLastName";
fr.Controls["__EVENTTARGET"].Value = "FormView1$CancelUpdateButton";
fr.Controls["__EVENTARGUMENT"].Value = "";
t.Request = fr;
pageHTML = t.Run ();
newHtml = HtmlDiff.GetControlFromPageHtml (pageHTML);
#if NET_4_0
origHtml = "<table cellspacing=\"0\" id=\"FormView1\" style=\"border-collapse:collapse;\">\r\n\t<tr>\r\n\t\t<td colspan=\"2\">\n <span id=\"FormView1_ID\">1001</span> \n <span id=\"FormView1_LName\">Test</span>\n <span id=\"FormView1_FName\">Merav</span> \n <a id=\"FormView1_EditButton\" href=\"javascript:__doPostBack('FormView1$EditButton','')\">Edit</a>\n <a id=\"FormView1_NewButton\" href=\"javascript:__doPostBack('FormView1$NewButton','')\">New</a>\n <a id=\"FormView1_DeleteButton\" href=\"javascript:__doPostBack('FormView1$DeleteButton','')\">Delete</a>\n </td>\r\n\t</tr><tr>\r\n\t\t<td colspan=\"2\"><table>\r\n\t\t\t<tr>\r\n\t\t\t\t<td><span>1</span></td><td><a href=\"javascript:__doPostBack('FormView1','Page$2')\">2</a></td><td><a href=\"javascript:__doPostBack('FormView1','Page$3')\">3</a></td>\r\n\t\t\t</tr>\r\n\t\t</table></td>\r\n\t</tr>\r\n</table>";
#else
origHtml = "<table cellspacing=\"0\" border=\"0\" id=\"FormView1\" style=\"border-collapse:collapse;\">\r\n\t<tr>\r\n\t\t<td colspan=\"2\">\n <span id=\"FormView1_ID\">1001</span> \n <span id=\"FormView1_LName\">Test</span>\n <span id=\"FormView1_FName\">Merav</span> \n <a id=\"FormView1_EditButton\" href=\"javascript:__doPostBack('FormView1$EditButton','')\">Edit</a>\n <a id=\"FormView1_NewButton\" href=\"javascript:__doPostBack('FormView1$NewButton','')\">New</a>\n <a id=\"FormView1_DeleteButton\" href=\"javascript:__doPostBack('FormView1$DeleteButton','')\">Delete</a>\n </td>\r\n\t</tr><tr>\r\n\t\t<td colspan=\"2\"><table border=\"0\">\r\n\t\t\t<tr>\r\n\t\t\t\t<td><span>1</span></td><td><a href=\"javascript:__doPostBack('FormView1','Page$2')\">2</a></td><td><a href=\"javascript:__doPostBack('FormView1','Page$3')\">3</a></td>\r\n\t\t\t</tr>\r\n\t\t</table></td>\r\n\t</tr>\r\n</table>";
#endif
HtmlDiff.AssertAreEqual (origHtml, newHtml, "CancelEditedRecordPostback");
}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:82,代码来源:FormViewTest.cs
示例11: Wizard_PostBackFireEvents_3
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");
}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:20,代码来源:WizardTest.cs
示例12: LoadPostData
public void LoadPostData () //Just flow and not implementation detail
{
WebTest t = new WebTest (PageInvoker.CreateOnLoad (LoadPostData_Load));
string html = t.Run ();
FormRequest fr = new FormRequest (t.Response, "form1");
fr.Controls.Add ("__EVENTTARGET");
fr.Controls.Add ("__EVENTARGUMENT");
fr.Controls.Add ("RadioButtonList1");
fr.Controls["__EVENTTARGET"].Value = "RadioButtonList1";
fr.Controls["__EVENTARGUMENT"].Value = "";
fr.Controls["RadioButtonList1"].Value = "test";
t.Request = fr;
t.Run ();
ArrayList eventlist = t.UserData as ArrayList;
if (eventlist == null)
Assert.Fail ("User data does not been created fail");
Assert.AreEqual ("ControlLoad", eventlist[0], "Live Cycle Flow #1");
Assert.AreEqual ("PageLoad", eventlist[1], "Live Cycle Flow #2");
Assert.AreEqual ("ControlLoad", eventlist[2], "Live Cycle Flow #3");
Assert.AreEqual ("LoadPostData", eventlist[3], "Live Cycle Flow #4");
}
开发者ID:Profit0004,项目名称:mono,代码行数:24,代码来源:RadioButtonListTest.cs
示例13: DetailsView_EmptyDataTextPropertyRender
public void DetailsView_EmptyDataTextPropertyRender ()
{
PageDelegate pd = new PageDelegate (DetailsView_EmptyDataTextProperty);
WebTest t = new WebTest (PageInvoker.CreateOnLoad (pd));
string result = t.Run ();
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;
//t.Invoker = PageInvoker.CreateOnLoad (pd);
result = t.Run ();
string newHtml = HtmlDiff.GetControlFromPageHtml (result);
#if NET_4_0
string origHtml = "<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<td>Empty Data</td>\r\n\t\t</tr>\r\n\t</table>\r\n</div><a id=\"LinkButton1\" href=\"javascript:__doPostBack('LinkButton1','')\">Test</a>";
#else
string origHtml = "<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<td>Empty Data</td>\r\n\t\t</tr>\r\n\t</table>\r\n</div><a id=\"LinkButton1\" href=\"javascript:__doPostBack('LinkButton1','')\">Test</a>";
#endif
HtmlDiff.AssertAreEqual(origHtml, newHtml, "EmptyDataTextTest");
}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:21,代码来源:DetailsViewTest.cs
示例14: CheckBoxList_Bug600415
public void CheckBoxList_Bug600415 ()
{
WebTest t = new WebTest ("CheckBoxList_Bug600415.aspx");
#if NET_4_0
string origHtmlFirst = "<table id=\"checkBoxList\">\r\n\t<tr>\r\n\t\t<td><input id=\"checkBoxList_0\" type=\"checkbox\" name=\"checkBoxList$0\" checked=\"checked\" value=\"Item 1\" /><label for=\"checkBoxList_0\">Item 1</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_1\" type=\"checkbox\" name=\"checkBoxList$1\" value=\"Item 2\" /><label for=\"checkBoxList_1\">Item 2</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_2\" type=\"checkbox\" name=\"checkBoxList$2\" checked=\"checked\" value=\"Item 3\" /><label for=\"checkBoxList_2\">Item 3</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_3\" type=\"checkbox\" name=\"checkBoxList$3\" value=\"Item 4\" /><label for=\"checkBoxList_3\">Item 4</label></td>\r\n\t</tr>\r\n</table>";
string origHtmlSecond = "<table id=\"checkBoxList\">\r\n\t<tr>\r\n\t\t<td><input id=\"checkBoxList_0\" type=\"checkbox\" name=\"checkBoxList$0\" value=\"Item 1\" /><label for=\"checkBoxList_0\">Item 1</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_1\" type=\"checkbox\" name=\"checkBoxList$1\" value=\"Item 2\" /><label for=\"checkBoxList_1\">Item 2</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_2\" type=\"checkbox\" name=\"checkBoxList$2\" value=\"Item 3\" /><label for=\"checkBoxList_2\">Item 3</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_3\" type=\"checkbox\" name=\"checkBoxList$3\" value=\"Item 4\" /><label for=\"checkBoxList_3\">Item 4</label></td>\r\n\t</tr>\r\n</table>";
string origHtmlThird = "<table id=\"checkBoxList\">\r\n\t<tr>\r\n\t\t<td><input id=\"checkBoxList_0\" type=\"checkbox\" name=\"checkBoxList$0\" checked=\"checked\" value=\"Item 1\" /><label for=\"checkBoxList_0\">Item 1</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_1\" type=\"checkbox\" name=\"checkBoxList$1\" checked=\"checked\" value=\"Item 2\" /><label for=\"checkBoxList_1\">Item 2</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_2\" type=\"checkbox\" name=\"checkBoxList$2\" checked=\"checked\" value=\"Item 3\" /><label for=\"checkBoxList_2\">Item 3</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_3\" type=\"checkbox\" name=\"checkBoxList$3\" checked=\"checked\" value=\"Item 4\" /><label for=\"checkBoxList_3\">Item 4</label></td>\r\n\t</tr>\r\n</table>";
#else
string origHtmlFirst = "<table id=\"checkBoxList\" border=\"0\">\r\n\t<tr>\r\n\t\t<td><input id=\"checkBoxList_0\" type=\"checkbox\" name=\"checkBoxList$0\" checked=\"checked\" /><label for=\"checkBoxList_0\">Item 1</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_1\" type=\"checkbox\" name=\"checkBoxList$1\" /><label for=\"checkBoxList_1\">Item 2</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_2\" type=\"checkbox\" name=\"checkBoxList$2\" checked=\"checked\" /><label for=\"checkBoxList_2\">Item 3</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_3\" type=\"checkbox\" name=\"checkBoxList$3\" /><label for=\"checkBoxList_3\">Item 4</label></td>\r\n\t</tr>\r\n</table>";
string origHtmlSecond = "<table id=\"checkBoxList\" border=\"0\">\r\n\t<tr>\r\n\t\t<td><input id=\"checkBoxList_0\" type=\"checkbox\" name=\"checkBoxList$0\" /><label for=\"checkBoxList_0\">Item 1</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_1\" type=\"checkbox\" name=\"checkBoxList$1\" /><label for=\"checkBoxList_1\">Item 2</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_2\" type=\"checkbox\" name=\"checkBoxList$2\" /><label for=\"checkBoxList_2\">Item 3</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_3\" type=\"checkbox\" name=\"checkBoxList$3\" /><label for=\"checkBoxList_3\">Item 4</label></td>\r\n\t</tr>\r\n</table>";
string origHtmlThird = "<table id=\"checkBoxList\" border=\"0\">\r\n\t<tr>\r\n\t\t<td><input id=\"checkBoxList_0\" type=\"checkbox\" name=\"checkBoxList$0\" checked=\"checked\" /><label for=\"checkBoxList_0\">Item 1</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_1\" type=\"checkbox\" name=\"checkBoxList$1\" checked=\"checked\" /><label for=\"checkBoxList_1\">Item 2</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_2\" type=\"checkbox\" name=\"checkBoxList$2\" checked=\"checked\" /><label for=\"checkBoxList_2\">Item 3</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_3\" type=\"checkbox\" name=\"checkBoxList$3\" checked=\"checked\" /><label for=\"checkBoxList_3\">Item 4</label></td>\r\n\t</tr>\r\n</table>";
#endif
string html = t.Run ();
string listHtml = HtmlDiff.GetControlFromPageHtml (html);
HtmlDiff.AssertAreEqual (origHtmlFirst, listHtml, "#A1");
FormRequest fr = new FormRequest (t.Response, "form1");
fr.Controls.Add ("cmdClick");
fr.Controls ["cmdClick"].Value = "Ok";
t.Request = fr;
html = t.Run ();
listHtml = HtmlDiff.GetControlFromPageHtml (html);
HtmlDiff.AssertAreEqual (origHtmlSecond, listHtml, "#A2");
fr = new FormRequest (t.Response, "form1");
fr.Controls.Add ("checkBoxList$0");
fr.Controls ["checkBoxList$0"].Value = "on";
fr.Controls.Add ("checkBoxList$1");
fr.Controls ["checkBoxList$1"].Value = "on";
fr.Controls.Add ("checkBoxList$2");
fr.Controls ["checkBoxList$2"].Value = "on";
fr.Controls.Add ("checkBoxList$3");
fr.Controls ["checkBoxList$3"].Value = "on";
t.Request = fr;
html = t.Run ();
listHtml = HtmlDiff.GetControlFromPageHtml (html);
HtmlDiff.AssertAreEqual (origHtmlThird, listHtml, "#A3");
}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:42,代码来源:CheckBoxListTest.cs
示例15: RaisePostDataChangedEvent_PostBack
|
请发表评论