Exemplo n.º 1
0
        public string GenerateTextReport(ITextProcessor txtProcessor)
        {
            string report = txtProcessor.AddHeader($"{this.customerName}'s Rental Record");

            foreach (var rental in this.customerRentals)
            {
                var amount = rental.GetRentalAmount();
                var title  = txtProcessor.AddTitle(rental.GetItemTitle());

                report += txtProcessor.AddLine($"{title}{amount}");
            }

            var footerContent = txtProcessor.AddLine($"Amount owed is {this.totalAmount}");

            footerContent += txtProcessor.Add($"{this.customerName} has {this.frequentRentPoints} frequent renter points");

            report += txtProcessor.AddFooter(footerContent);
            return(report);
        }