Example #1
0
        /// <summary>
        /// Format the result according to the spec
        /// </summary>
        /// <returns>The formatted result</returns>
        public override string ToString()
        {
            var sb = new StringBuilder();

            sb.AppendLine($"Subtotal: {SubTotal.ToCustomFormatString()}");
            foreach (var offer in Offers)
            {
                sb.AppendLine($"{offer.Description}: {offer.PriceDelta.ToCustomFormatString()}");
            }
            if (!Offers.Any())
            {
                sb.AppendLine("(No offers available)");
            }
            sb.AppendLine($"Total: {Total.ToCustomFormatString()}");
            return(sb.ToString());
        }