/// <summary>
 /// Generates text report.
 /// </summary>
 public void GenerateTextReport(string filename, string outcome, Utility.SortBy sortBy, CaseListItem.Separator separator)
 {
     string upperCaseOutcome = outcome.ToUpper();
     bool pass = true, fail = true, inconclusive = false, notrun = false;
     if (outcome != null)
     {
         pass = upperCaseOutcome.Contains("PASS");
         fail = upperCaseOutcome.Contains("FAIL");
         inconclusive = upperCaseOutcome.Contains("INCONCLUSIVE");
         notrun = upperCaseOutcome.Contains("NOTRUN");
     }
     var list = util.GenerateTextCaseListItems(pass,fail, inconclusive, notrun);
     string report = Utility.GeneratePlainTextReport(list, true, sortBy, separator);
     using (StreamWriter sw = new StreamWriter(filename))
     {
         sw.Write(report);
     }
 }
 /// <summary>
 /// Convert the list to plain text report
 /// </summary>
 /// <param name="items">Case list</param>
 /// <param name="showOutcome">shows test case outcome in the list</param>
 /// <param name="sortby">The way of sorting items in the test case list</param>
 /// <param name="separator">The style of the text file</param>
 /// <returns>Plain text report</returns>
 public static string GeneratePlainTextReport(List<CaseListItem> items, bool showOutcome, SortBy sortby, CaseListItem.Separator separator)
 {
     if (sortby == SortBy.Name)
     {
         items.Sort((x, y) => { return string.Compare(x.Name, y.Name); });
     }
     else
     {
         items.Sort((x, y) => { return string.Compare(x.Outcome, y.Outcome); });
     }
     StringBuilder sb = new StringBuilder();
     foreach (var i in items)
     {
         sb.AppendLine(i.FormatText(showOutcome, separator));
     }
     return sb.ToString();
 }