//private bool CheckOutputValue(SqlDataReader reader , SqlSync.SprocTest.Configuration.OutputResult output, int rowNum, out string message) //{ // message = ""; // bool passed = true; // try // { // if(reader[output.ColumnName].ToString().ToLower() != output.Value.ToString().ToLower()) // { // message = "Invalid Value Returned for Column " + output.ColumnName + ", Row# " + rowNum + ". Expected " + output.Value.ToString() + ", Retrieved " + reader[output.ColumnName].ToString(); // passed = false; // } // } // catch(SqlException exe) // { // message = "Sql Error Eetrieving expect column " + output.ColumnName + ". " + exe.Message + " Line Number:" + exe.LineNumber.ToString() + " Error Code:" + exe.ErrorCode.ToString(); // passed = false; // } // catch(Exception ex) // { // message = "Error Eetrieving expect column "+output.ColumnName+". "+ex.ToString(); // passed = false; // } // return passed; //} #endregion public static Database ReadConfiguration(string fileName) { if (!File.Exists(fileName)) { throw new FileNotFoundException("Unable to locate configuration file.", fileName); } Database cfg = null; using (StreamReader sr = new StreamReader(fileName)) { try { XmlSerializer serializer = new XmlSerializer(typeof(SprocTest.Configuration.Database)); object obj = serializer.Deserialize(sr); cfg = (SprocTest.Configuration.Database)obj; } catch (Exception exe) { throw new ApplicationException("Unable to deserialize the test configuration file at: " + fileName + "\r\n" + exe.ToString()); } } if (cfg == null) { throw new ApplicationException("Unable to deserialize the test configuration file at: " + fileName); } cfg.FileName = fileName; return(cfg); }
public void StartTests(BackgroundWorker bgWorker, DoWorkEventArgs workArgs) { if (this.cfg == null) { this.cfg = ReadConfiguration(this.fileName); } this.connData.DatabaseName = this.cfg.Name; for (int i = 0; i < this.cfg.StoredProcedure.Length; i++) { if (!TestStoredProcedure(this.cfg.StoredProcedure[i], bgWorker, workArgs)) { break; } } }
public TestManager(SprocTest.Configuration.Database cfg, ConnectionData connData) : this() { this.cfg = cfg; this.connData = connData; }