本文整理汇总了C#中MonoTests.SystemWeb.Framework.WebTest类的典型用法代码示例。如果您正苦于以下问题:C# WebTest类的具体用法?C# WebTest怎么用?C# WebTest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WebTest类属于MonoTests.SystemWeb.Framework命名空间,在下文中一共展示了WebTest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CapabilitiesUsedBySystemWebIE6
public void CapabilitiesUsedBySystemWebIE6 ()
{
WebTest t = new WebTest (PageInvoker.CreateOnLoad (CapabilitiesUsedBySystemWebIE6_OnLoad));
// Set UserAgent string to IE6
t.Request.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)";
t.Run ();
}
开发者ID:nobled,项目名称:mono,代码行数:7,代码来源:HttpBrowserCapabilitiesTest.cs
示例2: GetAppSetting1
public void GetAppSetting1 ()
{
PageDelegates pd = new PageDelegates ();
pd.Load = GetAppSetting1_Load;
WebTest test = new WebTest (new PageInvoker (pd));
test.Run ();
}
开发者ID:Profit0004,项目名称:mono,代码行数:7,代码来源:AppSettingsExpressionBuilderTest.cs
示例3: 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
示例4: TestStyle
public void TestStyle ()
{
string res = new WebTest (PageInvoker.CreateOnLoad (
new PageDelegate(_TestStyle))).Run ();
Assert.IsNotNull (res);
Assert.IsTrue (res != string.Empty);
}
开发者ID:nobled,项目名称:mono,代码行数:7,代码来源:Class1.cs
示例5: RenderSiteMapPathProp
public void RenderSiteMapPathProp ()
{
PageInvoker pi = PageInvoker.CreateOnLoad (_RenderSiteMapPathProp);
string res = new WebTest (pi).Run ();
Console.WriteLine (res);
Assert.IsFalse (string.IsNullOrEmpty (res));
}
开发者ID:nobled,项目名称:mono,代码行数:7,代码来源:Class1.cs
示例6: MappingUrl
public void MappingUrl()
{
WebTest t = new WebTest ("Mapping.aspx");
string result = t.Run ();
if (result.IndexOf ("Default from mapping") < 0)
Assert.Fail ("Mapping URL Fail");
}
开发者ID:nobled,项目名称:mono,代码行数:7,代码来源:MappingUrlTest.cs
示例7: 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
示例8: CapabilitiesUsedBySystemWebIE7
public void CapabilitiesUsedBySystemWebIE7 ()
{
WebTest t = new WebTest (PageInvoker.CreateOnLoad (CapabilitiesUsedBySystemWebIE7_OnLoad));
// Set UserAgent string to IE7
t.Request.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)";
t.Run ();
}
开发者ID:nobled,项目名称:mono,代码行数:7,代码来源:HttpBrowserCapabilitiesTest.cs
示例9: GlobalResourcesLocalization
public void GlobalResourcesLocalization ()
{
string pageHtml = new WebTest ("GlobalResourcesLocalization.aspx").Run ();
string renderedHtml = HtmlDiff.GetControlFromPageHtml (pageHtml);
string originalHtml = "<input type=\"submit\" name=\"button1\" value=\"Recharger\" id=\"button1\" />";
HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "#A1");
}
开发者ID:nobled,项目名称:mono,代码行数:8,代码来源:AppResourcesCompilerTest.cs
示例10: HtmlTitleCodeRender_Bug662918
public void HtmlTitleCodeRender_Bug662918 ()
{
string origHtml = "<head><title>\r\n\tTitle text\r\n</title></head>";
string pageHtml = new WebTest ("HtmlTitleCodeRender_Bug662918.aspx").Run ();
string renderedHtml = HtmlDiff.GetControlFromPageHtml (pageHtml);
HtmlDiff.AssertAreEqual (origHtml, renderedHtml, "#A1");
}
开发者ID:nobled,项目名称:mono,代码行数:8,代码来源:HtmlHeadTest.cs
示例11: TestMasterPage
public void TestMasterPage ()
{
PageInvoker pi = PageInvoker.CreateOnLoad (_TestMasterPage);
WebTest t = new WebTest (pi);
t.Request.Url = StandardUrl.PAGE_WITH_MASTER;
string res = t.Run ();
Console.WriteLine (res);
Assert.IsFalse (string.IsNullOrEmpty (res));
}
开发者ID:nobled,项目名称:mono,代码行数:9,代码来源:Class1.cs
示例12: HostedDefaultValues
public void HostedDefaultValues ()
{
StaticDefaultValues ("Before:");
WebTest t = new WebTest (PageInvoker.CreateOnLoad (HostedDefaultValues_OnLoad));
t.Run ();
Assert.AreEqual (global::System.Net.HttpStatusCode.OK, t.Response.StatusCode, "HttpStatusCode");
StaticDefaultValues ("After:");
}
开发者ID:sushihangover,项目名称:playscript,代码行数:10,代码来源:HostingEnvironmentTest.cs
示例13: Run
public WebTest Run (WebTest t)
{
NameValueCollection headers = new NameValueCollection ();
headers.Add (INVOKER_HEADER, Serialize (t.Invoker));
headers.Add (USER_HEADER, Serialize (t.UserData));
WebRequest wr = t.Request.CreateWebRequest (
#if TARGET_JVM
new Uri ("http://localhost:8080/MainsoftWebApp20/"),
#else
new Uri ("http://localhost:59598/NunitWebTest/"),
#endif
headers);
WebResponse response = null;
try {
response = wr.GetResponse ();
HttpStatusCode status = ((HttpWebResponse) response).StatusCode;
if (status != HttpStatusCode.OK && status != HttpStatusCode.Found)
throw new WebException (((HttpWebResponse) response).StatusCode.ToString ());
t.Response = t.Request.ExtractResponse (response);
string etype = response.Headers [EXCEPTION_HEADER];
if (!String.IsNullOrEmpty (etype)) {
Exception e;
string data = t.Response.Body;
int start = data.IndexOf (EXCEPTION_HEADER);
if (start >= 0) {
start += EXCEPTION_HEADER.Length;
int end = data.IndexOf (EXCEPTION_HEADER, start);
int length = int.Parse(data.Substring(start, end - start));
string serialized = data.Substring (end + EXCEPTION_HEADER.Length, length);
e = (Exception) DeserializeBinary (serialized);
}
else
e = (Exception) Activator.CreateInstance (Type.GetType(etype));
if (e != null)
RethrowException (e);
}
t.UserData = Deserialize (response.Headers [USER_HEADER]);
}
finally {
if (response != null)
response.Close ();
}
return t;
}
开发者ID:carrie901,项目名称:mono,代码行数:54,代码来源:MyHost.jvm.cs
示例14: Run
public WebTest Run (WebTest t)
{
_currentTest = t;
_doNext.Set ();
_done.WaitOne ();
if (_e != null) {
Exception e = _e;
_e = null;
throw e;
}
return t;
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:12,代码来源:MyHost.cs
示例15: Run
public WebTest Run (WebTest t)
{
HttpWorkerRequest wr = t.Request.CreateWorkerRequest ();
MyData data = GetMyData (wr);
data.currentTest = t;
data.exception = null;
HttpRuntime.ProcessRequest (wr);
t.Response = t.Request.ExtractResponse (wr);
if (data.exception != null)
RethrowException (data.exception);
return t;
}
开发者ID:nobled,项目名称:mono,代码行数:15,代码来源:MyHost.cs
示例16: 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
示例17: IsUserInRole
public void IsUserInRole ()
{
WebTest t = new WebTest (PageInvoker.CreateOnLoad ((Page p) => {
Assert.IsTrue (Roles.Enabled, "Enabled");
Assert.IsTrue (Roles.IsUserInRole ("true", "rolename"), "#1");
Assert.IsFalse (Roles.IsUserInRole ("false", "rolename"), "#2");
// NOTE: The next two tests do NOT throw an exception on MS
// .NET (even if the underlying membership-provider may,
// despite being documented differently on MSDN), but
// this convenient behaviour allows ASP.NET pages to run
// when roles are queried before the user is logged on
Assert.IsFalse (Roles.IsUserInRole (string.Empty, "rolename"), "#3a");
Assert.IsFalse (Roles.IsUserInRole ("rolename"), "#3b");
}));
t.Run ();
global::System.Diagnostics.Trace.WriteLineIf ((t.Response.StatusCode != global::System.Net.HttpStatusCode.OK), t.Response.Body);
Assert.AreEqual (global::System.Net.HttpStatusCode.OK, t.Response.StatusCode, "HttpStatusCode");
}
开发者ID:nobled,项目名称:mono,代码行数:19,代码来源:RolesTest.cs
示例18: 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
示例19: 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
示例20: FormView_DeleteAndEmptyTemplatePostback
public void FormView_DeleteAndEmptyTemplatePostback ()
{
WebTest t = new WebTest ("FormViewInsertEditDelete.aspx");
string pageHTML = t.Run ();
Assert.AreEqual (true, pageHTML.Contains ("1001"), "BeforeDelete1");
Assert.AreEqual (true, pageHTML.Contains ("Mahesh"), "BeforeDelete2");
Assert.AreEqual (true, pageHTML.Contains ("Chand"), "BeforeDelete3");
Assert.AreEqual (true, pageHTML.Contains ("Page$3"), "BeforeDelete4");
//Delete First Item
FormRequest fr = new FormRequest (t.Response, "form1");
fr.Controls.Add ("__EVENTTARGET");
fr.Controls.Add ("__EVENTARGUMENT");
fr.Controls["__EVENTTARGET"].Value = "FormView1$DeleteButton";
fr.Controls["__EVENTARGUMENT"].Value = "";
t.Request = fr;
pageHTML = t.Run ();
Assert.AreEqual (true, pageHTML.Contains ("1002"), "AfterFirstDelete1");
Assert.AreEqual (true, pageHTML.Contains ("Talmadge"), "AfterFirstDelete2");
Assert.AreEqual (true, pageHTML.Contains ("Melanie"), "AfterFirstDelete3");
Assert.AreEqual (true, pageHTML.Contains ("Page$2"), "AfterFirstDelete4");
Assert.AreEqual (false, pageHTML.Contains ("Page$3"), "AfterFirstDelete5");
//Delete second item
fr = new FormRequest (t.Response, "form1");
fr.Controls.Add ("__EVENTTARGET");
fr.Controls.Add ("__EVENTARGUMENT");
fr.Controls["__EVENTTARGET"].Value = "FormView1$DeleteButton";
fr.Controls["__EVENTARGUMENT"].Value = "";
t.Request = fr;
pageHTML = t.Run ();
Assert.AreEqual (true, pageHTML.Contains ("1003"), "AfterSecondDelete1");
Assert.AreEqual (true, pageHTML.Contains ("Bansal"), "AfterSecondDelete2");
Assert.AreEqual (true, pageHTML.Contains ("Vinay"), "AfterSecondDelete3");
Assert.AreEqual (false, pageHTML.Contains ("Page$2"), "AfterSecondDelete4");
//Delete last item and checking that the EmptyDataTemplate appears.
fr = new FormRequest (t.Response, "form1");
fr.Controls.Add ("__EVENTTARGET");
fr.Controls.Add ("__EVENTARGUMENT");
fr.Controls["__EVENTTARGET"].Value = "FormView1$DeleteButton";
fr.Controls["__EVENTARGUMENT"].Value = "";
t.Request = fr;
pageHTML = t.Run ();
Assert.AreEqual (true, pageHTML.Contains ("FormView1_Label1"), "EmptyTemplateTest1");
Assert.AreEqual (true, pageHTML.Contains ("The Database is empty"), "EmptyTemplateTest2");
}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:49,代码来源:FormViewTest.cs
注:本文中的MonoTests.SystemWeb.Framework.WebTest类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论