Exemple #1
0
        public void ItWorksOnAVeryLongList()
        {
            var size   = 100000;
            var input  = Range(1, size).Select(i => $"item{i}").ToList();
            var output = ListFormatter3.Format(input);

            Assert.AreEqual("100000. Item100000", output[size - 1]);
        }
Exemple #2
0
        public void ItWorksOnSingletonList()
        {
            var input = new List <string> {
                "coffee beans"
            };
            var output = ListFormatter3.Format(input);

            Assert.AreEqual("1. Coffee beans", output[0]);
        }
Exemple #3
0
        public void ItWorksOnLongerList()
        {
            var input = new List <string> {
                "coffee beans", "BANANAS"
            };
            var output = ListFormatter3.Format(input);

            Assert.AreEqual("1. Coffee beans", output[0]);
            Assert.AreEqual("2. Bananas", output[1]);
        }
Exemple #4
0
        public static void Run()
        {
            var input = new List <string> {
                "coffee beans", "BANANAS", "Dates"
            };
            var output = new ListFormatter().Format(input);

            // Method group - same as writing x => WriteLine(x)
            output.ForEach(WriteLine);

            ListFormatter2.Format(input).ForEach(WriteLine);
            ListFormatter3.Format(input).ForEach(WriteLine);
        }