當前位置: 首頁>>代碼示例>>C#>>正文


C# Framework.WebTest類代碼示例

本文整理匯總了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 ();
		}
開發者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"">&nbsp;</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


注:本文中的MonoTests.SystemWeb.Framework.WebTest類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。