public void PdfReplacerTest() { SimulationEngineTestPreparer se = new SimulationEngineTestPreparer("MasterBatch"); List <string> arguments = new List <string> { "--Batch-ModularHouseholds" }; Config.IsInUnitTesting = true; MainSimEngine.Run(arguments.ToArray(), "simulationengine.exe"); DateTime d = DateTime.Now; string dstDir = @"x:\Calc\" + d.Year + "." + d.Month + "." + d.Day + ".." + d.Hour + "." + d.Minute; using (Process p = new Process { StartInfo = { FileName = "robocopy.exe", Arguments = se.WorkingDirectory + " " + dstDir + " /E /MIR", UseShellExecute = true } }) { p.Start(); } using (var p = new Process { StartInfo = { FileName = "robocopy.exe" } }) { dstDir = @"e:\masterbatchForImport"; p.StartInfo.Arguments = se.WorkingDirectory + " " + dstDir + " /E /MIR"; p.StartInfo.UseShellExecute = true; p.Start(); p.WaitForExit(); p.Dispose(); } se.Clean(); }
public void CSVImportTest2() { using (var db1 = new DatabaseSetup(Utili.GetCurrentMethodAndClass() + "_export")) { //export using (var wd = SetupDB3(Utili.GetCurrentMethodAndClass())) { const string srcfile = @"v:\work\CHR15a_Sc1.csv"; File.Copy(srcfile, Path.Combine(wd.WorkingDirectory, "hh.csv")); var sim = new Simulator("Data Source=profilegenerator.db3") { MyGeneralConfig = { CSVCharacter = ";" } }; sim.MyGeneralConfig.SaveToDB(); var dbm = new DatabaseMerger(sim); const string importPath = @"v:\work\profilegenerator_hennings.db3"; dbm.RunFindItems(importPath, null); dbm.RunImport(null); ModularHouseholdSerializer.ExportAsCSV(sim.ModularHouseholds[0], sim, Path.Combine(wd.WorkingDirectory, "testexportfile.csv")); //import var arguments = new List <string> { "--ImportHouseholdDefinition", "hh.csv" }; MainSimEngine.Run(arguments.ToArray(), "simulationengine.exe"); db1.Cleanup(); wd.CleanUp(1); } } }
public void RunTest() { SimulationEngineTestPreparer se = new SimulationEngineTestPreparer("MasterBatch"); List <string> arguments = new List <string> { "--MakeMasterBatch" }; MainSimEngine.Run(arguments.ToArray(), "simulationengine.exe"); DateTime d = DateTime.Now; string dstDir = @"x:\Calc\" + d.Year + "." + d.Month + "." + d.Day + ".." + d.Hour + "." + d.Minute; Process p = new Process { StartInfo = { FileName = "robocopy.exe", Arguments = se.WorkingDirectory + " " + dstDir + " /E /MIR", UseShellExecute = true } }; p.Start(); p.WaitForExit(); p.Dispose(); p = new Process { StartInfo = { FileName = "robocopy.exe" } }; dstDir = @"e:\masterbatchForImport"; p.StartInfo.Arguments = se.WorkingDirectory + " " + dstDir + " /E /MIR"; p.StartInfo.UseShellExecute = true; p.Start(); p.WaitForExit(); p.Dispose(); se.Clean(); }
public void MainTestForHelp() { using (var wd = SetupDB3(Utili.GetCurrentMethodAndClass())) { var args = Array.Empty <string>(); Assert.Throws <LPGException>(() => MainSimEngine.Run(args.ToArray(), "simulationengine.exe")); wd.CleanUp(1); } }
public void MainTestNoDB3() { Config.CatchErrors = false; if (File.Exists("profilegenerator.db3")) { File.Delete("profilegenerator.db3"); } Config.IsInUnitTesting = true; var args = Array.Empty <string>(); Assert.Throws <LPGException>(() => MainSimEngine.Run(args.ToArray(), "simulationengine.exe")); }
public void RunTest() { using SimulationEngineTestPreparer se = new SimulationEngineTestPreparer("MakeResults1PV"); List <string> arguments = new List <string> { "--MakeResults1PV", @"X:\R1_PV_2kw", @"F:\DissCalcsResults\PVResults_2kw" }; MainSimEngine.Run(arguments.ToArray(), "simulationengine.exe"); se.Clean(); }
public void RunNaturalLightBatch() { Config.IsInUnitTesting = true; Config.CatchErrors = false; SimulationEngineTestPreparer se = new SimulationEngineTestPreparer("RunNaturalLight"); List <string> arguments = new List <string> { "--MakeLightBatch" }; MainSimEngine.Run(arguments.ToArray(), "simulationengine.exe"); se.Clean(); }
public void MainTestBatchCommandlineModularHouseholds() { using (var wd = SetupDB3(Utili.GetCurrentMethodAndClass())) { var arguments = new List <string>(); var dstpath = Path.Combine(wd.WorkingDirectory, "calc"); var args = "Calculate -CalcObjectType ModularHousehold -CalcObjectNumber 0 -OutputFileDefault ReasonableWithChartsAndPDF " + "-StartDate 01.01.2015 -EndDate 10.01.2015 -SkipExisting -OutputDirectory " + dstpath; arguments.AddRange(args.Split(' ')); arguments = arguments.Where(x => !string.IsNullOrWhiteSpace(x)).ToList(); MainSimEngine.Run(arguments.ToArray(), "simulationengine.exe"); wd.CleanUp(1); } }
public void MainTestLaunchParallelModularHouseholds() { Config.CatchErrors = false; var di = new DirectoryInfo("."); var fis = di.GetFiles("*.*"); var oldDir = Directory.GetCurrentDirectory(); var db3Path = Path.Combine(oldDir, "profilegenerator-latest.db3"); using (var wd = new WorkingDir("ModularBatchPar")) { Thread.Sleep(1000); var prevDir = Directory.GetCurrentDirectory(); Directory.SetCurrentDirectory(wd.WorkingDirectory); foreach (var fi in fis) { var dstpath = Path.Combine(wd.WorkingDirectory, fi.Name); fi.CopyTo(dstpath); } if (File.Exists("profilegenerator.db3")) { File.Delete("profilegenerator.db3"); } File.Copy(db3Path, "profilegenerator.db3"); const string filename = "Start-ModularHousehold.cmd"; if (File.Exists(filename)) { File.Delete(filename); } var arguments = new List <string> { "--Batch-ModularHouseholds" }; MainSimEngine.Run(arguments.ToArray(), "simulationengine.exe"); File.Exists(filename).Should().BeTrue(); arguments.Clear(); arguments.Add("--LaunchParallel"); arguments.Add("--NumberCores"); arguments.Add("4"); arguments.Add("--Batchfile"); arguments.Add("Start-ModularHousehold.cmd"); MainSimEngine.Run(arguments.ToArray(), "simulationengine.exe"); Directory.SetCurrentDirectory(prevDir); wd.CleanUp(1); } }
public void RunTest() { const string path = @"G:\2016.2.1..20.6"; Directory.SetCurrentDirectory(path); List <string> arguments = new List <string> { "--LaunchParallel", "--NumberCores", "3", "--Batchfile", "Start-DissR2NoBridge.cmd", "--Archive", @"x:\R2_BridgeDaysWithout" }; MainSimEngine.Run(arguments.ToArray(), "simulationengine.exe"); }
public void CSVImportTest() { using (var db1 = new DatabaseSetup(Utili.GetCurrentMethodAndClass() + "_export")) { //export using (var wd = SetupDB3(Utili.GetCurrentMethodAndClass())) { var sim = new Simulator(db1.ConnectionString); ModularHouseholdSerializer.ExportAsCSV(sim.ModularHouseholds[0], sim, Path.Combine(wd.WorkingDirectory, "testexportfile.csv")); //import var arguments = new List <string> { "--ImportHouseholdDefinition", "testexportfile.csv" }; MainSimEngine.Run(arguments.ToArray(), "simulationengine.exe"); db1.Cleanup(); wd.CleanUp(1); } } }
public static void Main([NotNull][ItemNotNull] string[] args) { CommandProcessor.MakeFlameChart = ChartMaker.MakeFlameChart; CommandProcessor.Makeallthecharts = ChartMaker.MakeChartsAndPDF; MainSimEngine.Run(args, "simulationengine.exe"); }
public static void Main([NotNull][ItemNotNull] string[] args) { MainSimEngine.Run(args, "simengine2.exe"); }