示例#1
0
        void Process()
        {
            Console.WriteLine("BASIC FIZZBUZZER - 1-100");
            var fizzbuzzer = new BasicFizzBuzzer(1, 100);
            WriteFizzBuzzes(fizzbuzzer);
            Pause();

            Console.WriteLine("BASIC FIZZBUZZER - 100-1");
            fizzbuzzer = new BasicFizzBuzzer(100, 1);
            WriteFizzBuzzes(fizzbuzzer);
            Pause();

            Console.WriteLine("CUSTOM FIZZBUZZER - 1-100");
            var customfizzbuzzer = new CustomFizzBuzzer(1, 100);
            WriteFizzBuzzes(customfizzbuzzer);
            Pause();

            Console.WriteLine("CUSTOM FIZZBUZZER - 1-1,000,000 PERFORMANCE TEST");
            customfizzbuzzer = new CustomFizzBuzzer(1, 1000000);
            Console.Write("Working...");
            var sw = Stopwatch.StartNew();
            var results = customfizzbuzzer.Execute().ToList();
            sw.Stop();
            Console.WriteLine("Done. Time elapsed: {0} ms", sw.ElapsedMilliseconds);
            Pause();
        }
 public void BasicFizzBuzz_NonMultiplesOf3Or5ReturnsNumber()
 {
     var results = new BasicFizzBuzzer(1, 3).Execute().ToList();
     Assert.AreEqual("1", results[0]);
 }
 public void BasicFizzBuzz_MultiplesOf3And5ReturnsFizzBuzz()
 {
     var results = new BasicFizzBuzzer(1, 15).Execute().ToList();
     Assert.AreEqual("fizzbuzz", results[14]);
 }
 public void BasicFizzBuzz_MultipleOf5ReturnsBuzz()
 {
     var results = new BasicFizzBuzzer(1, 5).Execute().ToList();
     Assert.AreEqual("buzz", results[4]);
 }
 public void BasicFizzBuzz_MultipleOf3ReturnsFizz()
 {
     var results = new BasicFizzBuzzer(1, 3).Execute().ToList();
     Assert.AreEqual("fizz", results[2]);
 }