Microsoft.Silverlight.Testing.Client.TestMethodData.GetResultReport C# (CSharp) Method

GetResultReport() public method

Retrieves the results report.
public GetResultReport ( ) : string
return string
        public string GetResultReport()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("Test Method: ");
            sb.AppendLine(Name);
            sb.AppendLine(this.Result.ToString());
            sb.AppendLine(Passed ? "Passed" : "Failed");

            // CONSIDER: Provide more information here

            return sb.ToString();
        }

Usage Example

コード例 #1
0
        /// <summary>
        /// Offers clipboard interface support for copying test run results.
        /// </summary>
        /// <param name="sender">The source object.</param>
        /// <param name="e">The event arguments.</param>
        protected virtual void OnClipboardButtonClick(object sender, EventArgs e)
        {
            Button b    = (Button)sender;
            string tag  = (string)b.Tag;
            string text = string.Empty;

            switch (tag)
            {
            case "CopyAllChecked":
                StringBuilder sb    = new StringBuilder();
                int           count = 0;
                foreach (KeyValuePair <object, TreeViewItem> item in resultsTreeView.GetCheckedItemsAndContainers())
                {
                    // Only want the actual leaf nodes
                    TestMethodData tmd = item.Key as TestMethodData;
                    if (tmd != null)
                    {
                        sb.AppendLine(tmd.GetResultReport());
                        count++;
                    }
                }
                if (count == 0)
                {
                    sb.AppendLine("There were no checked results.");
                    text = sb.ToString();
                }
                else
                {
                    text = "There were " +
                           count.ToString() +
                           " results checked." +
                           Environment.NewLine +
                           Environment.NewLine +
                           sb.ToString();
                }

                break;

            case "CopyResults":
                IProvideResultReports result = resultsTreeView.SelectedItem as IProvideResultReports;
                if (result != null)
                {
                    text = result.GetResultReport();
                }
                break;

            default:
            case "Close":
                ClipboardContents.Text         = string.Empty;
                ClipboardHelperGrid.Visibility = Visibility.Collapsed;
                return;
            }

            SetClipboardText(text);
        }