Beispiel #1
0
        static void Main(string[] args)
        {
            var lucky       = new ContainsPipe(3, "lucky");
            var fizz        = new NumberSubstitutePipe(3, "fizz");
            var buzz        = new NumberSubstitutePipe(5, "buzz");
            var fizzbuzz    = new CompositePipe(fizz, buzz);
            var defaultPipe = new DefaultNumberPipe();

            List <IPipe> pipes = new List <IPipe>()
            {
                lucky,
                fizzbuzz,
                fizz,
                buzz,
                defaultPipe
            };

            var runner = new Runner(Enumerable.Range(1, 20), pipes);

            foreach (var item in runner.Run())
            {
                Console.WriteLine(item);
            }

            Console.ReadLine();
        }
Beispiel #2
0
        public void Contains_pipe_check_passes_correctly(int input, bool expected)
        {
            IPipe pipe = new ContainsPipe(3, string.Empty);

            Assert.Equal(expected, pipe.Check(input));
        }