public void Create_backup_of_real_spreadsheet__Will_create_backup_even_when_paths_contain_a_mix_of_slashes() { // Arrange var debug_mode_switcher = new DebugModeSwitcher(new InputOutput()); var mock_clock = new Mock <IClock>(); var now_date_time = DateTime.Now; mock_clock.Setup(x => x.Now_date_time()).Returns(now_date_time); var path_with_mixed_slashes = Mix_slashes(ReconConsts.Test_backup_file_path); // Act debug_mode_switcher.Create_backup_of_real_spreadsheet(mock_clock.Object, path_with_mixed_slashes); // Assert // This test will fail on the Mac, so don't even bother. string source_file_path = ReconConsts.Test_backup_file_path + "/" + ReconConsts.Main_spreadsheet_file_name; if (File.Exists(source_file_path)) { var expected_backup_file = ReconConsts.Test_backup_file_path + @"\SpreadsheetBackups\real_backup_" + now_date_time.ToString().Replace(" ", "_").Replace(":", "-").Replace("/", "-") + "_" + ReconConsts.Main_spreadsheet_file_name; Assert.IsTrue(File.Exists(expected_backup_file)); } }
public void Reconciliate() { try { ISpreadsheetRepoFactory spreadsheet_factory = new DebugModeSwitcher(_input_output).Decide_on_debug(); Do_matching(spreadsheet_factory); } catch (Exception exception) { if (exception.Message.ToUpper() == "EXIT") { _input_output.Output_line("Taking you back to the main screen so you can start again if you want."); } else { _input_output.Show_error(exception); } } }
public void Copy_source_spreadsheet_to_debug_spreadsheet__Will_copy_real_spreadsheet_into_debug_spreadsheet() { // Arrange var debug_mode_switcher = new DebugModeSwitcher(new InputOutput()); string debug_file_path = Path.Combine(ReconConsts.Test_backup_file_path, ReconConsts.Backup_sub_folder, ReconConsts.Debug_spreadsheet_file_name); string source_file_path = Path.Combine(ReconConsts.Test_backup_file_path, ReconConsts.Main_spreadsheet_file_name); File.Delete(debug_file_path); Assert.IsFalse(File.Exists(debug_file_path)); // Act debug_mode_switcher.Copy_source_spreadsheet_to_debug_spreadsheet(ReconConsts.Test_backup_file_path, ReconConsts.Test_backup_file_path); // Assert // This test will fail on the Mac, so don't even bother. if (File.Exists(source_file_path)) { Assert.IsTrue(File.Exists(debug_file_path)); } }