Ejemplo n.º 1
0
        /// <summary>
        /// Author:     Brian Sabotta
        /// Created:    10/30/2019
        /// Notes:      Gets a descriptor string for CoinPurses which contain change details for each line in the source file.
        /// </summary>
        /// <param name="sourceData">A collection of lines of text, representing source data to be processed.</param>
        /// <returns>Returns a descriptor string of all CoinPurses generated for every line in the source file.</returns>
        private static string GetAllCoinPurseDescriptors(IEnumerable <string> sourceData)
        {
            var returnValue = new StringBuilder();

            foreach (var currentLine in sourceData)
            {
                //Break up each line by splitting on the comma delimiter
                var dataRow = currentLine.Split(',');
                if (dataRow.Length > 1)
                {
                    var currentPurse = CoinPurse.GetChangePurse(dataRow[0], dataRow[1]);
                    //Example output has double-spacing, so we'll do the same for ease of reading.
                    returnValue.AppendLine($"{currentPurse.GetCollectionVerboseString()}{Environment.NewLine}");
                }
            }
            return(returnValue.ToString());
        }