public void Empty_fields_are_output_as_nothing_for_csv()
        {
            // Arrange
            var    cred_card2_in_out_record = new CredCard2InOutRecord();
            string csv_line = String.Format("19/04/2017^^^Acme: Esmerelda's birthday^");

            cred_card2_in_out_record.Load(csv_line);
            cred_card2_in_out_record.Matched = true;

            // Act
            string constructed_csv_line = cred_card2_in_out_record.To_csv();

            // Assert
            Assert.AreEqual("19/04/2017,,x,\"Acme: Esmerelda's birthday\",,", constructed_csv_line);
        }
        public void Csv_is_constructed_correctly_without_matched_record()
        {
            // Arrange
            var    cred_card2_in_out_record = new CredCard2InOutRecord();
            string csv_line = String.Format("19/04/2017^£13.48^^Acme: Esmerelda's birthday^£33.44");

            cred_card2_in_out_record.Load(csv_line);
            cred_card2_in_out_record.Matched = true;

            // Act
            string constructed_csv_line = cred_card2_in_out_record.To_csv();

            // Assert
            Assert.AreEqual("19/04/2017,£13.48,x,\"Acme: Esmerelda's birthday\",£33.44,", constructed_csv_line);
        }
        public void Amounts_should_be_written_using_pound_signs()
        {
            // Arrange
            var    cred_card2_in_out_record = new CredCard2InOutRecord();
            var    amount_with_pound_sign   = "£123.55";
            string csv_line = String.Format("19/04/2017^{0}^^Acme: Esmerelda's birthday^", amount_with_pound_sign);

            cred_card2_in_out_record.Load(csv_line);

            // Act
            string constructed_csv_line = cred_card2_in_out_record.To_csv();

            // Assert
            string expected_csv_line = String.Format("19/04/2017,{0},,\"Acme: Esmerelda's birthday\",,", amount_with_pound_sign);

            Assert.AreEqual(expected_csv_line, constructed_csv_line);
        }
        public void Amounts_containing_commas_should_be_encased_in_quotes()
        {
            // Arrange
            var    cred_card2_in_out_record = new CredCard2InOutRecord();
            var    amount_containing_comma  = "£1,234.55";
            string csv_line = String.Format("19/04/2017^{0}^^Acme: Esmerelda's birthday^", amount_containing_comma);

            cred_card2_in_out_record.Load(csv_line);

            // Act
            string constructed_csv_line = cred_card2_in_out_record.To_csv();

            // Assert
            string expected_csv_line = String.Format("19/04/2017,\"{0}\",,\"Acme: Esmerelda's birthday\",,", amount_containing_comma);

            Assert.AreEqual(expected_csv_line, constructed_csv_line);
        }
        public void Csv_is_constructed_correctly_with_matched_record()
        {
            // Arrange
            var    cred_card2_in_out_record = new CredCard2InOutRecord();
            string csv_line = String.Format("19/04/2017^£13.48^^Acme: Esmerelda's birthday^£33.44");

            cred_card2_in_out_record.Load(csv_line);
            cred_card2_in_out_record.Matched = true;
            string matched_record_csv_line = String.Format("08/06/2017,ACME UK HOLDINGS,Ms Pippi Long,ref,13.49");
            var    matched_record          = new CredCard2Record();

            matched_record.Load(matched_record_csv_line);
            cred_card2_in_out_record.Match = matched_record;

            // Act
            string constructed_csv_line = cred_card2_in_out_record.To_csv();

            // Assert
            Assert.AreEqual("19/04/2017,£13.48,x,\"Acme: Esmerelda's birthday\",£33.44,,,08/06/2017,£13.49,\"ACME UK HOLDINGS\"", constructed_csv_line);
        }