Exemple #1
0
        public void Empty_fields_are_output_as_nothing_for_csv()
        {
            // Arrange
            var    cred_card1_in_out_record = new CredCard1InOutRecord();
            string csv_line = String.Format("19/12/2016^^^Bantams^^");

            cred_card1_in_out_record.Load(csv_line);
            cred_card1_in_out_record.Matched = false;

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

            // Assert
            Assert.AreEqual("19/12/2016,,,\"Bantams\",,", constructed_csv_line);
        }
Exemple #2
0
        public void Csv_is_constructed_correctly_without_matched_record()
        {
            // Arrange
            var    cred_card1_in_out_record = new CredCard1InOutRecord();
            string csv_line = String.Format("19/12/2016^£12.34^^Bantams^£33.44^");

            cred_card1_in_out_record.Load(csv_line);
            cred_card1_in_out_record.Matched = false;

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

            // Assert
            Assert.AreEqual("19/12/2016,£12.34,,\"Bantams\",£33.44,", constructed_csv_line);
        }
Exemple #3
0
        public void Amounts_should_be_written_using_pound_signs()
        {
            // Arrange
            var    cred_card1_in_out_record = new CredCard1InOutRecord();
            var    amount_with_pound_sign   = "£123.55";
            string csv_line = String.Format("19/12/2016^{0}^^Bantams^", amount_with_pound_sign);

            cred_card1_in_out_record.Load(csv_line);

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

            // Assert
            string expected_csv_line = String.Format("19/12/2016,{0},,\"Bantams\",,", amount_with_pound_sign);

            Assert.AreEqual(expected_csv_line, constructed_csv_line);
        }
Exemple #4
0
        public void Amounts_containing_commas_should_be_encased_in_quotes()
        {
            // Arrange
            var    cred_card1_in_out_record = new CredCard1InOutRecord();
            var    amount_containing_comma  = "£1,234.55";
            string csv_line = String.Format("19/12/2016^{0}^^Bantams^", amount_containing_comma);

            cred_card1_in_out_record.Load(csv_line);

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

            // Assert
            string expected_csv_line = String.Format("19/12/2016,\"{0}\",,\"Bantams\",,", amount_containing_comma);

            Assert.AreEqual(expected_csv_line, constructed_csv_line);
        }
Exemple #5
0
        public void Csv_is_constructed_correctly_with_matched_record()
        {
            // Arrange
            var    cred_card1_in_out_record = new CredCard1InOutRecord();
            string csv_line = String.Format("19/12/2016^£12.34^^Bantams^£33.44^");

            cred_card1_in_out_record.Load(csv_line);
            cred_card1_in_out_record.Matched = false;
            string matched_record_csv_line = String.Format("17/02/2017,23/11/2018,22223333,\"ANY STORE\",12.33");
            var    matched_record          = new CredCard1Record();

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

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

            // Assert
            Assert.AreEqual("19/12/2016,£12.34,,\"Bantams\",£33.44,,,17/02/2017,£12.33,\"ANY STORE\"", constructed_csv_line);
        }