public ISpreadsheetRepoFactory Decide_on_debug() { _input_output.Output_line(""); _input_output.Output_options(new List <string> { $"1. Debug Mode A: Copy live sheet to debug version in [live location]/{ReconConsts.Backup_sub_folder}, and work on it from there.", $"2. Debug Mode B: Copy sheet from {ReconConsts.Source_debug_spreadsheet_path} to [live location]/{ReconConsts.Backup_sub_folder}, and work on it from there.", "3. Debug Mode C: Use fake spreadsheet repo (like you would get in .Net Core).", "4. Work in REAL mode" }); string input = _input_output.Get_generic_input(ReconConsts.DebugOrReal); WorkingMode working_mode = WorkingMode.DebugA; ISpreadsheetRepoFactory spreadsheet_factory = new FakeSpreadsheetRepoFactory();; switch (input) { case "1": { working_mode = WorkingMode.DebugA; spreadsheet_factory = Debug_mode_a(); } break; case "2": { working_mode = WorkingMode.DebugB; spreadsheet_factory = Debug_mode_b(); } break; case "3": { working_mode = WorkingMode.DebugC; spreadsheet_factory = Debug_mode_c(); } break; case "4": { working_mode = WorkingMode.Real; spreadsheet_factory = Real_mode(); } break; } new Communicator(_input_output).Show_instructions(working_mode); return(spreadsheet_factory); }
public void Start() { _input_output.Output_line(""); _input_output.Output_options(new List <string> { ReconConsts.Load_pending_csvs, "2. Do actual reconciliation." }); string input = _input_output.Get_generic_input(ReconConsts.PendingOrReconciliate); switch (input) { case "1": { ISpreadsheetRepoFactory spreadsheet_factory = new FakeSpreadsheetRepoFactory(); var path = new PathSetter(_input_output, spreadsheet_factory).Set_path(); var file_loader = new FileLoader(_input_output); file_loader.Create_pending_csvs(path); } break; case "2": { Do_actual_reconciliation(); } break; } }
public void Create_pending_csvs() { try { ISpreadsheetRepoFactory spreadsheet_factory = new FakeSpreadsheetRepoFactory(); var path = new PathSetter(_input_output, spreadsheet_factory).Set_path(); var pending_csv_file_creator = new PendingCsvFileCreator(path); pending_csv_file_creator.Create_and_populate_all_csvs(); } catch (Exception e) { _input_output.Output_line(e.Message); } }
public void Will_not_attempt_to_dispose_null_spreadsheet() { // Arrange var fake_spreadsheet_factory = new FakeSpreadsheetRepoFactory(); // Act bool exception_thrown = false; try { // Because we haven't called the Create method, spreadsheet should be null. fake_spreadsheet_factory.Dispose_of_spreadsheet_repo(); } catch (Exception) { exception_thrown = true; } // Assert Assert.IsFalse(exception_thrown, "Exception should not be thrown"); }