private void GenerateReport() { //create instance of report object. Reports rept = new Reports(ConfigurationSettings.DatabaseServer, ConfigurationSettings.DatabaseName, ConfigurationSettings.DatabaseUserName, ConfigurationSettings.DatabasePassword); //Add the stores to the report generator for (int i = 0; i < Reports_Stores.SelectedIndices.Count; ++i) { rept.AddStore(Convert.ToInt32(((BoxFormat)Reports_Stores.Items[Reports_Stores.SelectedIndices[i]]).databaseID)); } // generate the report and place it into a Webbrowser window. string report = rept.GenerateReport(Reports_Listbox.SelectedIndex); webReports.Navigate("about:blank"); //if a report exists we have to empty the control if (webReports.Document != null) { webReports.Document.Write(string.Empty); } webReports.DocumentText = report; }
public void TestReports_Report2() { // arrange Reports rept = new Reports(DBServer, DBName, DBUser, DBPassword); rept.AddStore(1); bool expected = true; //act - initalize string report = rept.GenerateReport(2); bool actual = report.Contains("<th align=\"center\" colspan=\"3\">Sales By Month</th>"); // assert Assert.AreEqual(expected, actual, "Unexpected Report."); }