本文整理汇总了C#中MonoTests.SystemWeb.Framework.WebTest类的典型用法代码示例。如果您正苦于以下问题:C# WebTest类的具体用法?C# WebTest怎么用?C# WebTest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WebTest类属于MonoTests.SystemWeb.Framework命名空间,在下文中一共展示了WebTest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 ();
}
示例2: GetAppSetting1
public void GetAppSetting1 ()
{
PageDelegates pd = new PageDelegates ();
pd.Load = GetAppSetting1_Load;
WebTest test = new WebTest (new PageInvoker (pd));
test.Run ();
}
示例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");
}
示例4: TestStyle
public void TestStyle ()
{
string res = new WebTest (PageInvoker.CreateOnLoad (
new PageDelegate(_TestStyle))).Run ();
Assert.IsNotNull (res);
Assert.IsTrue (res != string.Empty);
}
示例5: RenderSiteMapPathProp
public void RenderSiteMapPathProp ()
{
PageInvoker pi = PageInvoker.CreateOnLoad (_RenderSiteMapPathProp);
string res = new WebTest (pi).Run ();
Console.WriteLine (res);
Assert.IsFalse (string.IsNullOrEmpty (res));
}
示例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");
}
示例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");
}
示例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 ();
}
示例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");
}
示例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");
}
示例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));
}
示例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:");
}
示例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;
}
示例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;
}
示例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;
}