⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testpropertiesdialog.cs

📁 C#编写的网络爬虫程序 效率很高 很好用!
💻 CS
📖 第 1 页 / 共 2 页
字号:
			// resultsTab
			// 
			this.resultsTab.Controls.Add(this.assertCount);
			this.resultsTab.Controls.Add(this.label3);
			this.resultsTab.Controls.Add(this.testResult);
			this.resultsTab.Controls.Add(this.stackTrace);
			this.resultsTab.Controls.Add(this.label12);
			this.resultsTab.Controls.Add(this.elapsedTime);
			this.resultsTab.Controls.Add(this.message);
			this.resultsTab.Location = new System.Drawing.Point(4, 22);
			this.resultsTab.Name = "resultsTab";
			this.resultsTab.Size = new System.Drawing.Size(338, 116);
			this.resultsTab.TabIndex = 1;
			this.resultsTab.Text = "Result";
			// 
			// assertCount
			// 
			this.assertCount.Location = new System.Drawing.Point(193, 13);
			this.assertCount.Name = "assertCount";
			this.assertCount.Size = new System.Drawing.Size(118, 14);
			this.assertCount.TabIndex = 37;
			this.assertCount.Text = "Asserts:";
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(20, 42);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(53, 13);
			this.label3.TabIndex = 36;
			this.label3.Text = "Message:";
			this.label3.TextAlign = System.Drawing.ContentAlignment.TopRight;
			// 
			// testResult
			// 
			this.testResult.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.testResult.Location = new System.Drawing.Point(20, 14);
			this.testResult.Name = "testResult";
			this.testResult.Size = new System.Drawing.Size(60, 14);
			this.testResult.TabIndex = 35;
			this.testResult.Text = "Failure";
			// 
			// stackTrace
			// 
			this.stackTrace.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
				| System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.stackTrace.CopySupported = true;
			this.stackTrace.Expansion = CP.Windows.Forms.TipWindow.ExpansionStyle.Both;
			this.stackTrace.Location = new System.Drawing.Point(87, 69);
			this.stackTrace.Name = "stackTrace";
			this.stackTrace.Size = new System.Drawing.Size(244, 39);
			this.stackTrace.TabIndex = 29;
			// 
			// label12
			// 
			this.label12.Location = new System.Drawing.Point(13, 69);
			this.label12.Name = "label12";
			this.label12.Size = new System.Drawing.Size(60, 14);
			this.label12.TabIndex = 28;
			this.label12.Text = "Stack:";
			this.label12.TextAlign = System.Drawing.ContentAlignment.TopRight;
			// 
			// elapsedTime
			// 
			this.elapsedTime.Location = new System.Drawing.Point(87, 14);
			this.elapsedTime.Name = "elapsedTime";
			this.elapsedTime.Size = new System.Drawing.Size(86, 14);
			this.elapsedTime.TabIndex = 27;
			this.elapsedTime.Text = "Time:";
			// 
			// message
			// 
			this.message.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.message.CopySupported = true;
			this.message.Expansion = CP.Windows.Forms.TipWindow.ExpansionStyle.Both;
			this.message.Location = new System.Drawing.Point(87, 42);
			this.message.Name = "message";
			this.message.Size = new System.Drawing.Size(238, 13);
			this.message.TabIndex = 25;
			// 
			// pinButton
			// 
			this.pinButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
			this.pinButton.Appearance = System.Windows.Forms.Appearance.Button;
			this.pinButton.Location = new System.Drawing.Point(337, 7);
			this.pinButton.Name = "pinButton";
			this.pinButton.Size = new System.Drawing.Size(16, 17);
			this.pinButton.TabIndex = 14;
			this.pinButton.Click += new System.EventHandler(this.pinButton_Click);
			this.pinButton.CheckedChanged += new System.EventHandler(this.pinButton_CheckedChanged);
			// 
			// TestPropertiesDialog
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(361, 150);
			this.Controls.Add(this.pinButton);
			this.Controls.Add(this.tabControl1);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "TestPropertiesDialog";
			this.ShowInTaskbar = false;
			this.Text = "Test Properties";
			this.Load += new System.EventHandler(this.TestPropertiesDialog_Load);
			this.tabControl1.ResumeLayout(false);
			this.testTab.ResumeLayout(false);
			this.resultsTab.ResumeLayout(false);
			this.ResumeLayout(false);

		}

		#endregion

		#region Properties

		[Browsable( false )]
		public bool Pinned
		{
			get { return pinButton.Checked; }
			set { pinButton.Checked = value; }
		}

		#endregion

		#region Methods

		private void closeButton_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}

		private void SetTitleBarText()
		{
			string type;
			if ( test.IsTestCase )
				type = "Case";
			else if ( test.IsFixture )
				type = "Fixture";
			else
				type = "Suite";

			this.Text = string.Format( "Test {0} Properties - {1}", type, test.ShortName );
		}

		/// <summary>
		/// Set up all dialog fields when it loads
		/// </summary>
		private void TestPropertiesDialog_Load(object sender, System.EventArgs e)
		{
			pinnedImage = new Bitmap( typeof( TestPropertiesDialog ), "pinned.gif" );
			unpinnedImage = new Bitmap( typeof( TestPropertiesDialog ), "unpinned.gif" );
			pinButton.Image = unpinnedImage;

			DisplayProperties();

			node.TreeView.AfterSelect += new TreeViewEventHandler( OnSelectedNodeChanged );	
		}

		private void OnSelectedNodeChanged( object sender, TreeViewEventArgs e )
		{
			if ( pinButton.Checked )
			{
				DisplayProperties( (TestSuiteTreeNode)e.Node );
			}
			else
				this.Close();
		}

		public void DisplayProperties( )
		{
			DisplayProperties( this.node );
		}

		public void DisplayProperties( TestSuiteTreeNode node)
		{
			this.node = node;
			this.test = node.Test;
			this.result = node.Result;

			SetTitleBarText();

			// Initialize Test Tab
			fullName.Text = test.FullName;
			shouldRun.Text = test.ShouldRun ? "Yes" : "No";
			description.Text = test.Description;
			ignoreReason.Text = test.IgnoreReason;
			testCaseCount.Text = test.CountTestCases().ToString();

			// Initialize Result Tab
			if ( result == null || !result.Executed )
				tabControl1.TabPages.Remove( resultsTab );
			else
			{
				if ( !tabControl1.TabPages.Contains( resultsTab ) )
				{
					tabControl1.TabPages.Add( resultsTab );
				}

				testResult.Text = result.IsSuccess ? "Success" : "Failure";
				// message may have a leading blank line
				// TODO: take care of this in label?
				message.Text = TrimLeadingBlankLines( result.Message );
				elapsedTime.Text = string.Format( "Time: {0}", result.Time );
				assertCount.Text = string.Format( "Asserts: {0}", result.AssertCount );
				stackTrace.Text = result.StackTrace;
			}
		}

		private string TrimLeadingBlankLines( string s )
		{
			if ( s == null ) return s;

			int start = 0;
			for( int i = 0; i < s.Length; i++ )
			{
				switch( s[i] )
				{
					case ' ':
					case '\t':
						break;
					case '\r':
					case '\n':
						start = i + 1;
						break;

					default:
						goto getout;
				}
			}

			getout:
			return start == 0 ? s : s.Substring( start );
		}

		protected override bool ProcessKeyPreview(ref System.Windows.Forms.Message m)
		{
			const int ESCAPE = 27;
			const int WM_CHAR = 258;

			if (m.Msg == WM_CHAR && m.WParam.ToInt32() == ESCAPE )
			{
				this.Close();
				return true;
			}

			return base.ProcessKeyEventArgs( ref m ); 
		}

		private void pinButton_Click(object sender, System.EventArgs e)
		{
			if ( pinButton.Checked )
				pinButton.Image = pinnedImage;
			else
				pinButton.Image = unpinnedImage;
		}

		private void pinButton_CheckedChanged(object sender, System.EventArgs e)
		{
		
		}
	}

	#endregion
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -