当前位置: 首页>>代码示例>>C#>>正文


C# WebTest.Run方法代码示例

本文整理汇总了C#中MonoTests.SystemWeb.Framework.WebTest.Run方法的典型用法代码示例。如果您正苦于以下问题:C# WebTest.Run方法的具体用法?C# WebTest.Run怎么用?C# WebTest.Run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MonoTests.SystemWeb.Framework.WebTest的用法示例。


在下文中一共展示了WebTest.Run方法的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");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:25,代码来源:CrossPagePostingTest.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: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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:Profit0004,项目名称:mono,代码行数:19,代码来源:RolesTest.cs

示例13: FormView_DataSourceChangedEvent

		public void FormView_DataSourceChangedEvent ()
		{
			WebTest t = new WebTest();
			PageDelegates pd = new PageDelegates ();
			pd.Load = FormView_Init;
			pd.PreRenderComplete = FormView_Load;
			t.Invoker = new PageInvoker (pd);
			t.Run ();
			FormRequest fr = new FormRequest (t.Response, "form1");
			fr.Controls.Add ("__EVENTTARGET");
			fr.Controls.Add ("__EVENTARGUMENT");
			fr.Controls["__EVENTTARGET"].Value = "";
			fr.Controls["__EVENTARGUMENT"].Value = "";
			t.Request = fr;
			t.Run ();
			if (t.UserData == null)
				Assert.Fail ("DataSourceChangedEvent#1");
			Assert.AreEqual ("Data_rebounded", t.UserData.ToString (), "DataSourceChangedEvent#2");
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:19,代码来源:FormViewTest.cs

示例14: DetailsView_UpdatePostback

		[Category ("NotDotNet")] // Implementation details in mono
		public void DetailsView_UpdatePostback ()
		{
			WebTest t = new WebTest ("DetailsViewDataActions.aspx");
			t.Invoker = PageInvoker.CreateOnLoad (UpdatePostback_Load);
			string pageHTML = t.Run ();
			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 ();
			
			fr = new FormRequest (t.Response, "form1");

			fr.Controls.Add ("__EVENTTARGET");
			fr.Controls.Add ("__EVENTARGUMENT");
			fr.Controls.Add ("DetailsView1$ctl01");
			fr.Controls.Add ("DetailsView1$ctl02");

			fr.Controls["__EVENTTARGET"].Value = "DetailsView1$ctl03";
			fr.Controls["__EVENTARGUMENT"].Value = "";
			fr.Controls["DetailsView1$ctl01"].Value = "1";
			fr.Controls["DetailsView1$ctl02"].Value = "2";

			t.Request = fr;
			t.Run ();

			// Checking for insert event fired.
			ArrayList eventlist = t.UserData as ArrayList;
			if (eventlist == null)
				Assert.Fail ("User data does not been created fail");

			Assert.AreEqual ("ItemCommand", eventlist[0], "#1");
			Assert.AreEqual ("ItemCommand", eventlist[1], "#2");
			Assert.AreEqual ("ItemUpdating", eventlist[2], "#3");
			Assert.AreEqual ("ItemUpdated", eventlist[3], "#4");
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:39,代码来源:DetailsViewTest.cs

示例15: 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(&#39;LinkButton1&#39;,&#39;&#39;)\">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


注:本文中的MonoTests.SystemWeb.Framework.WebTest.Run方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。