本文整理汇总了C#中MonoTests.SystemWeb.Framework.PageDelegates类的典型用法代码示例。如果您正苦于以下问题:C# PageDelegates类的具体用法?C# PageDelegates怎么用?C# PageDelegates使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PageDelegates类属于MonoTests.SystemWeb.Framework命名空间,在下文中一共展示了PageDelegates类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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");
}
示例2: GetAppSetting1
public void GetAppSetting1 ()
{
PageDelegates pd = new PageDelegates ();
pd.Load = GetAppSetting1_Load;
WebTest test = new WebTest (new PageInvoker (pd));
test.Run ();
}
示例3: CreateOnPreInit
/// <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;
}
示例4: CreateOnLoad
/// <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: 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");
}
示例6: 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");
}
示例7: Wizard_PostBack
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");
}
示例8: ListItemsViewState4
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");
}
示例9: Wizard_PostBackFireEvents_2
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");
}
示例10: Menu_PostBackFireEvents_2
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");
}
示例11: Menu_Templates
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 ();
}
示例12: ImageField_NullDisplayText
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> </td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><span>NullDisplayText</span></td><td> </td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><span>NullDisplayText</span></td><td> </td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><span>NullDisplayText</span></td><td> </td>\r\n\t\t</tr><tr>\r\n\t\t\t<td><span>NullDisplayText</span></td><td> </td>\r\n\t\t</tr>\r\n\t</table>\r\n</div>";
string htmlControl = HtmlDiff.GetControlFromPageHtml (htmlPage);
HtmlDiff.AssertAreEqual (htmlOrigin, htmlControl, "ImageFieldNullText");
}
示例13: Menu_PostBack
[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 ();
}
示例14: BasicPostbackTest
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");
}
示例15: ImageField_GetFormattedAlternateText
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");
}