public void Can_write_new_contents_to_csv()
        {
            // Arrange
            var file_io  = new FileIO <BankRecord>(new FakeSpreadsheetRepoFactory(), _csv_file_path, "BankIn-formatted-date-only");
            var csv_file = new CSVFile <BankRecord>(file_io);

            csv_file.Load();
            var new_bank_record = new BankRecord();
            // Date, unreconciled amount, type and description are mandatory.
            // string csvLine = String.Format("DATE^UNRECONCILED_AMT^^TYPE^DESCRIPTION^^^^^");
            var todays_date = DateTime.Today.ToString("dd/MM/yyyy");

            new_bank_record.Load(String.Format("{0}^£12.34^^POS^Purchase^^^^^", todays_date));
            csv_file.Records.Add(new_bank_record);

            // Act
            csv_file.Write_to_csv_file("testing");

            // Assert
            var file_io_test_file = new FileIO <BankRecord>(new FakeSpreadsheetRepoFactory(), _csv_file_path, "BankIn-formatted-date-only-testing");
            var new_csv_file      = new CSVFile <BankRecord>(file_io_test_file);

            new_csv_file.Load(
                true,
                ',');
            List <string> csv_lines = new_csv_file.All_records_as_csv();

            Assert.AreEqual("01/02/2017,£350.00,,ABC,\"ZZZThing3\",,,,,", csv_lines[0]);
            Assert.AreEqual("01/03/2017,£350.00,,ABC,\"ZZZThing2\",,,,,", csv_lines[1]);
            Assert.AreEqual("24/03/2017,£200.12,,PCL,\"ZZZSpecialDescription001\",,,,,", csv_lines[2]);
            Assert.AreEqual("01/04/2017,£261.40,,PCL,\"ZZZSpecialDescription005\",,,,,", csv_lines[3]);
            Assert.AreEqual("03/04/2017,£350.00,,ABC,\"ZZZThing1\",,,,,", csv_lines[4]);
            Assert.AreEqual(String.Format("{0},£12.34,,POS,\"Purchase\",,,,,", todays_date), csv_lines[5]);
        }
        public void Can_output_all_records_as_csv_ordered_by_matched_and_then_by_date()
        {
            // Arrange
            const bool doNotOrderByDate = false;
            var        file_io          = new FileIO <BankRecord>(new FakeSpreadsheetRepoFactory(), _csv_file_path, "BankIn-formatted-date-only");
            var        csv_file         = new CSVFile <BankRecord>(file_io);

            csv_file.Load(
                true,
                null,
                doNotOrderByDate);
            csv_file.Records[0].Matched = true;
            csv_file.Records[1].Matched = true;
            csv_file.Records[3].Matched = true;

            // Act
            List <string> csv_lines = csv_file.All_records_as_csv();

            // Assert
            Assert.AreEqual("01/03/2017,£350.00,x,ABC,\"ZZZThing2\",,,,,", csv_lines[0]);
            Assert.AreEqual("24/03/2017,£200.12,x,PCL,\"ZZZSpecialDescription001\",,,,,", csv_lines[1]);
            Assert.AreEqual("03/04/2017,£350.00,x,ABC,\"ZZZThing1\",,,,,", csv_lines[2]);
            Assert.AreEqual("01/02/2017,£350.00,,ABC,\"ZZZThing3\",,,,,", csv_lines[3]);
            Assert.AreEqual("01/04/2017,£261.40,,PCL,\"ZZZSpecialDescription005\",,,,,", csv_lines[4]);
        }