/// <summary>
        /// Prints the results.
        /// </summary>
        /// <returns></returns>
        private string PrintResults()
        {
            HtmlTable table = new HtmlTable();
            table.EnableTheming = true;
            table.Border = 1;
            table.BorderColor = "#000000";
            table.Width = "100%";
            table.CellSpacing = 0;

            foreach (var featureName in ListResults.GroupBy(item => item.FeatureName))
            {
                HtmlTableRow tableName = new HtmlTableRow();
                HtmlTableCell tableNameCell = new HtmlTableCell("th");
                tableNameCell.ColSpan = 4;
                tableName.BorderColor = "#FFFFFF";
                tableNameCell.Attributes.CssStyle.Value = "border-bottom: None;border-right:None;border-top:None;border-left:None; font-family:Verdana; font-size:13pt;color:#FFFFFF;";
                tableNameCell.BgColor = "#808080";
                tableNameCell.Align = "left";
                tableNameCell.InnerText = "Feature Name: " + featureName.Key;
                tableName.BgColor = "#808080";

                tableName.Cells.Add(tableNameCell);
                table.Rows.Add(tableName);

                foreach (var testScenario in featureName.GroupBy(item => item.ScenarioName))
                {
                    HtmlTableRow appheaderRow = new HtmlTableRow();
                    HtmlTableCell header = new HtmlTableCell("th");
                    header.ColSpan = 2;
                    appheaderRow.BgColor = "#808080";
                    appheaderRow.BorderColor = "#FFFFFF";
                    header.BgColor = "#808080";
                    header.Attributes.CssStyle.Value = "border-bottom: None;border-right:None;border-top:1px solid;border-left:None; font-family:Verdana; font-size:9pt;color:#FFFFFF;";
                    header.Align = "Left";
                    header.InnerText = "Test Scenario: " + testScenario.Key;
                    appheaderRow.Cells.Add(header);

                    header = new HtmlTableCell("th");
                    header.ColSpan = 1;
                    appheaderRow.BgColor = "#808080";
                    appheaderRow.BorderColor = "#FFFFFF";
                    header.BgColor = "#808080";
                    header.Attributes.CssStyle.Value = "border-bottom: None;border-right:None;border-top:1px solid;border-left:None; font-family:Verdana; font-size:9pt;color:#FFFFFF;";
                    header.Align = "Left";
                    header.InnerText = "Test Duration";
                    appheaderRow.Cells.Add(header);

                    header = new HtmlTableCell("th");
                    header.ColSpan = 2;
                    appheaderRow.BgColor = "#808080";
                    appheaderRow.BorderColor = "#FFFFFF";
                    header.BgColor = "#808080";
                    header.Attributes.CssStyle.Value = "border-bottom: None;border-right:None;border-top:1px solid;border-left:None; font-family:Verdana; font-size:9pt;color:#FFFFFF;";
                    header.Align = "Left";
                    header.InnerText = "Status";
                    appheaderRow.Cells.Add(header);
                    table.Rows.Add(appheaderRow);
                    HtmlTableRow tableHeadings = new HtmlTableRow();

                    appheaderRow.Cells.Add(header);
                    table.Rows.Add(appheaderRow);
                    int x = 1;
                    foreach (var testParameters in testScenario.GroupBy(item => item.TestParameters))
                    {
                        HtmlTableRow testparamets = new HtmlTableRow();
                        testparamets.ID = this.testParameterRowCount.ToString();
                        testparamets.Attributes.Add("onclick", "rowsHideShow(this);");
                        HtmlTableCell testparametersName = new HtmlTableCell();
                        testparametersName.ColSpan = 2;

                        testparametersName.Attributes.CssStyle.Value = "border-bottom: None;border-right:None;border-top:None;border-left:None; font-family:Verdana; font-size:10pt;padding:5px 5px 5px 5px; cursor: pointer;";
                        if (x % 2 == 0)
                        {
                            testparamets.BgColor = "#FFFFFF";
                        }
                        else
                        {
                            testparamets.BgColor = "#F0F0F0";
                        }

                        testparametersName.Align = "Left";
                        testparametersName.InnerText = "Test Run:" + x++;
                        testparamets.Cells.Add(testparametersName);

                        foreach (TestResult result in testParameters)
                        {
                            HtmlTableCell cell;
                            cell = new HtmlTableCell();
                            cell.ColSpan = 1;
                            cell.Attributes.CssStyle.Value = "border-bottom: None;border-right:None;border-top:None;border-left:None; font-family:Verdana; font-size:10pt;padding:5px 5px 5px 5px;";
                            cell.Align = "Left";
                            cell.InnerText = this.GetTotalTimeResult(result.StartTime, result.EndTime);
                            testparamets.Cells.Add(cell);

                            if (x % 2 == 0)
                            {
                                testparamets.BgColor = "#FFFFFF";
                            }
                            else
                            {
                                testparamets.BgColor = "#F0F0F0";
                            }

                            cell = new HtmlTableCell();
                            cell.ColSpan = 1;
                            if (result.TestStatus == Enums.TestStatus.Failed)
                            {
                                if (result.ErrorMessage.Equals("Failed to execute tests due to insufficient GACS access."))
                                {
                                    cell.Attributes.CssStyle.Value = "border-bottom:None; border-right:None; border-top:None; border-left:None;font-family:Verdana;font-size:9pt;font-weight:bold;";
                                    cell.InnerText = result.ErrorMessage;
                                }
                                else
                                {
                                    cell.Attributes.CssStyle.Value = "border-bottom:None; border-right:None; border-top:None; border-left:None;font-family:Verdana;font-size:9pt;font-weight:bold;color:#FFFFFF;vertical-align:middle;position:relative;";
                                    cell.InnerHtml = "<a href =" + result.ImagePath + "> " + result.ErrorMessage + "</a> &nbsp;" + @"<div style=""background:#ac2925; width: 20px; height:20px; border-radius:50%;display:inline-block;position:absolute;bottom:10%""></div>";
                                }
                            }
                            else if (result.TestStatus == Enums.TestStatus.Completed)
                            {
                                cell.Attributes.CssStyle.Value = "border-bottom:None; border-right:None; border-top:None; border-left:None;font-weight:bold;color:#FFFFFF;font-family:Verdana;font-size:9pt; vertical-align:middle;position:relative;";
                                cell.InnerHtml = "<a href =" + testParameters.First().ImagePath.ToString() + "> " + result.TestStatus.ToString() + "</a> &nbsp;" + @"<div style=""background:#397439; width: 20px; height:20px; border-radius:50%;display:inline-block;position:absolute;bottom:10%""></div>";
                            }

                            testparamets.Cells.Add(cell);

                            table.Rows.Add(testparamets);
                            this.testParameterRowCount++;
                            if (result.CurrentData != null)
                            {
                                HtmlTableRow testDataRow = new HtmlTableRow();
                                testDataRow.ID = this.testParameterRowCount.ToString();
                                testDataRow.Style.Add(HtmlTextWriterStyle.Display, "none");
                                testDataRow.Style.Add(HtmlTextWriterStyle.Width, "100%");

                                HtmlTableCell testDataCell = new HtmlTableCell();
                                testDataCell.Attributes.CssStyle.Value = "border-bottom:None; border-right:None; border-top:None; border-left:None;";
                                testDataCell.ColSpan = 4;
                                testDataCell.Width = "100%";

                                HtmlTable testDataTable = new HtmlTable();
                                testDataTable.Width = "100%";
                                testDataTable.Attributes.CssStyle.Value = "border-bottom:None; border-right:None; border-top:None; border-left:None;";

                                foreach (TestAutomationTemplate.Core.TestResult.TestData td in result.CurrentData)
                                {
                                    HtmlTableRow testDataTableRow = new HtmlTableRow();
                                    testDataTableRow.Attributes.CssStyle.Value = "border-bottom:None; border-right:None; border-top:None; border-left:None;";
                                    if (x % 2 == 0)
                                    {
                                        testDataTable.BgColor = "#FFFFFF";
                                    }
                                    else
                                    {
                                        testDataTable.BgColor = "#F0F0F0";
                                    }

                                    HtmlTableCell testDataTableCell = new HtmlTableCell();
                                    testDataTableCell.InnerHtml = "<li><b>" + td.Name + "</b>: " + td.Value + "</li>";
                                    testDataTableCell.ColSpan = 4;
                                    testDataTableCell.Width = "100%";
                                    testDataTableCell.Attributes.CssStyle.Value = "border-bottom:None;border-right:None;border-top:None;border-left:None; font-family:Verdana; font-size:8pt;padding:5px 5px 5px 5px;text-indent:50px;";
                                    testDataTableRow.Cells.Add(testDataTableCell);
                                    testDataTable.Rows.Add(testDataTableRow);
                                }

                                StringBuilder innerTable = new StringBuilder();
                                testDataTable.RenderControl(new HtmlTextWriter(new StringWriter(innerTable)));
                                testDataCell.InnerHtml = innerTable.ToString();
                                testDataRow.Cells.Add(testDataCell);
                                table.Rows.Add(testDataRow);
                                this.testParameterRowCount++;
                            }
                            else
                            {
                                HtmlTableRow testDataRow = new HtmlTableRow();
                                testDataRow.ID = this.testParameterRowCount.ToString();
                                testDataRow.Style.Add(HtmlTextWriterStyle.Display, "none");
                                testDataRow.Style.Add(HtmlTextWriterStyle.Width, "100%");

                                HtmlTableCell testDataCell = new HtmlTableCell();
                                testDataCell.Attributes.CssStyle.Value = "border-bottom:None; border-right:None; border-top:None; border-left:None;font-family:Verdana; font-size:8pt;";
                                testDataCell.ColSpan = 4;
                                testDataCell.Width = "100%";
                                testDataCell.InnerHtml = "<b>Test Parameters not available</b>";
                                testDataRow.Cells.Add(testDataCell);
                                table.Rows.Add(testDataRow);
                                this.testParameterRowCount++;
                            }
                        }
                    }
                }
            }

            StringBuilder stringBuilder = new StringBuilder();
            table.RenderControl(new HtmlTextWriter(new StringWriter(stringBuilder)));
            this.emailBody = this._reportJavaScript.WriteHTMLHeaderInformation().ToString() + this.PrintOverallStats().ToString() + stringBuilder.ToString() + this._reportJavaScript.GenerateJavaScriptCode(this.testDataRowCount).ToString();
            string reportDirectory = CustomConfiguration.TempDirectory;
            File.WriteAllText(reportDirectory + "Results.html", this.emailBody);
            this.CopyImagestoReportFolder(reportDirectory);
            stringBuilder.Clear();
            table.Dispose();

            return this.emailBody.ToString();
        }
        /// <summary>
        /// Noes the results.
        /// </summary>
        /// <returns></returns>
        private string NoResults()
        {
            HtmlTable NoResultsTable = new HtmlTable();
            NoResultsTable.EnableTheming = true;
            NoResultsTable.Border = 1;
            NoResultsTable.BorderColor = "#000000";
            NoResultsTable.Width = "100%";
            NoResultsTable.CellSpacing = 0;

            HtmlTableRow NoResultsTableName = new HtmlTableRow();
            HtmlTableCell NoResultsTableNameCell = new HtmlTableCell("th");
            NoResultsTableNameCell.ColSpan = 4;
            NoResultsTableName.BorderColor = "#FFFFFF";
            NoResultsTableNameCell.Attributes.CssStyle.Value = "border-bottom: None;border-right:None;border-top:None;border-left:None; font-family:Verdana; font-size:9pt;color:#FFFFFF;";
            NoResultsTableNameCell.BgColor = "#808080";
            NoResultsTableNameCell.Align = "left";
            NoResultsTableNameCell.InnerText = "No test results available";
            NoResultsTableName.BgColor = "#808080";

            NoResultsTableName.Cells.Add(NoResultsTableNameCell);
            NoResultsTable.Rows.Add(NoResultsTableName);

            StringBuilder NoResultsStringBuilder = new StringBuilder();
            NoResultsTable.RenderControl(new HtmlTextWriter(new StringWriter(NoResultsStringBuilder)));
            this.emailBody = NoResultsStringBuilder.ToString();
            NoResultsStringBuilder.Clear();
            NoResultsTable.Dispose();

            return this.emailBody.ToString();
        }