public void WhenCreatingNewInvoiceList_GetRecordsShouldBeEmptyButNotNull()
        {
            // arrange & act
            var invoiceList = new InvoiceList();

            // assert
            invoiceList.GetRecords().Should().NotBeNull();
            invoiceList.GetRecords().Should().BeEmpty();
        }
        public void WhenAddingRecordsToInvoiceList_RecordsSouldBeUpdated(List <Record> records)
        {
            // arrange
            var invoiceList = new InvoiceList();

            // act
            foreach (var record in records)
            {
                invoiceList.AddRecord(record);
            }

            // assert
            invoiceList.GetRecords().Should().NotBeEmpty();
            invoiceList.GetRecords().Should().BeEquivalentTo(records);
            invoiceList.CountRecords().Should().Be(records.Count);
        }
예제 #3
0
        public static string Generate(InvoiceList invoiceList, bool withHeader = false)
        {
            StringBuilder sb = new StringBuilder();

            if (withHeader)
            {
                sb.AppendLine(HEADER);
            }

            foreach (var record in invoiceList.GetRecords())
            {
                sb.AppendLine(CreateCsvLine(record));
            }

            return(sb.ToString());
        }