/// <summary> /// Make a regression object /// </summary> /// <param name="regressionType">The type of regressions to run</param> /// <param name="unitTestsToRun">The list of unit tests to run</param> public PatchRegression(PatchRegressionTypes regressionType, List <PatchUnitTest> unitTestsToRun) { if (unitTestsToRun == null) { throw new NullReferenceException(); } string logFilename; UnitTests = unitTestsToRun; switch (regressionType) { case PatchRegressionTypes.json: RegressionTypeString = "json"; RegressionExtension = string.Format(".{0}", RegressionTypeString); Startfile = string.Format("{0}{1}", Startfile, RegressionExtension); RegressionFolderPath = Path.Combine(PatchLogFolder, RegressionTypeString); logFilename = Path.Combine(PatchLogFolder, "logs", string.Format("{0}_{1}{2}", RegressionTypeString, DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss"), ".log")); RegressionLogfile = new Logfile(logFilename, Logging.ApplicationLogfileTimestamp, true); break; case PatchRegressionTypes.regex: RegressionTypeString = "regex"; RegressionExtension = string.Format(".{0}", "txt"); Startfile = string.Format("{0}{1}", Startfile, RegressionExtension); RegressionFolderPath = Path.Combine(PatchLogFolder, RegressionTypeString); logFilename = Path.Combine(PatchLogFolder, "logs", string.Format("{0}_{1}{2}", RegressionTypeString, DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss"), ".log")); RegressionLogfile = new Logfile(logFilename, Logging.ApplicationLogfileTimestamp, true); break; case PatchRegressionTypes.xml: RegressionTypeString = "xml"; RegressionExtension = string.Format(".{0}", RegressionTypeString); Startfile = string.Format("{0}{1}", Startfile, RegressionExtension); RegressionFolderPath = Path.Combine(PatchLogFolder, RegressionTypeString); logFilename = Path.Combine(PatchLogFolder, "logs", string.Format("{0}_{1}{2}", RegressionTypeString, DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss"), ".log")); RegressionLogfile = new Logfile(logFilename, Logging.ApplicationLogfileTimestamp, true); break; case PatchRegressionTypes.followPath: RegressionTypeString = "json"; RegressionExtension = string.Format(".{0}", "xc"); Startfile = string.Format("{0}{1}", @"@xvm", RegressionExtension); RegressionFolderPath = Path.Combine(PatchLogFolder, "followPath"); logFilename = Path.Combine(PatchLogFolder, "logs", string.Format("{0}_{1}{2}", "followPath", DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss"), ".log")); RegressionLogfile = new Logfile(logFilename, Logging.ApplicationLogfileTimestamp, true); break; } RegressionLogfile.OnLogfileWrite += RegressionLogfile_OnLogfileWrite; }
/// <summary> /// Make a regression object /// </summary> /// <param name="regressionType">The type of regressions to run</param> /// <param name="unitTestsToRun">The list of unit tests to run</param> public Regression(PatchRegressionTypes regressionType, List <UnitTest> unitTestsToRun) { UnitTests = unitTestsToRun; switch (regressionType) { case PatchRegressionTypes.json: RegressionTypeString = "json"; RegressionExtension = string.Format(".{0}", RegressionTypeString); Startfile = string.Format("{0}{1}", Startfile, RegressionExtension); RegressionFolderPath = Path.Combine("patch_regressions", RegressionTypeString); RegressionLogfile = new Logfile(Path.Combine("patch_regressions", "logs", string.Format("{0}_{1}{2}", RegressionTypeString, DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss"), ".log")), Logging.ApplicationLogfileTimestamp); break; case PatchRegressionTypes.regex: RegressionTypeString = "regex"; RegressionExtension = string.Format(".{0}", "txt"); Startfile = string.Format("{0}{1}", Startfile, RegressionExtension); RegressionFolderPath = Path.Combine("patch_regressions", RegressionTypeString); RegressionLogfile = new Logfile(Path.Combine("patch_regressions", "logs", string.Format("{0}_{1}{2}", RegressionTypeString, DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss"), ".log")), Logging.ApplicationLogfileTimestamp); break; case PatchRegressionTypes.xml: RegressionTypeString = "xml"; RegressionExtension = string.Format(".{0}", RegressionTypeString); Startfile = string.Format("{0}{1}", Startfile, RegressionExtension); RegressionFolderPath = Path.Combine("patch_regressions", RegressionTypeString); RegressionLogfile = new Logfile(Path.Combine("patch_regressions", "logs", string.Format("{0}_{1}{2}", RegressionTypeString, DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss"), ".log")), Logging.ApplicationLogfileTimestamp); break; case PatchRegressionTypes.followPath: RegressionTypeString = "json"; RegressionExtension = string.Format(".{0}", "xc"); Startfile = string.Format("{0}{1}", @"@xvm", RegressionExtension); RegressionFolderPath = Path.Combine("patch_regressions", "followPath"); RegressionLogfile = new Logfile(Path.Combine("patch_regressions", "logs", string.Format("{0}_{1}{2}", "followPath", DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss"), ".log")), Logging.ApplicationLogfileTimestamp); break; } }