static void Main(string[] args) { var fizzBuzz = new FizzBuzz(); for (var i = 1; i <= 100; i++) { Console.WriteLine(fizzBuzz.GetOutput(i)); } Console.WriteLine("Press enter to quit..."); Console.ReadLine(); }
static void Main(string[] args) { var fizzBuzz = new FizzBuzz(); for (int index = 1; index <= 100; index++) { var result = fizzBuzz.MultipleOfThreeAsFizz(index); result += fizzBuzz.MultipleOfFiveAsBuzz(index); if (string.IsNullOrWhiteSpace(result)) { result = index.ToString(); } Console.WriteLine(result); } Console.ReadLine(); }
public void FizzBuzzBottomHigherThanTopOutputEmptyString() { FizzBuzz fizzBuzz = new FizzBuzz(); Assert.AreEqual(string.Empty, fizzBuzz.LineOutput(20, 1)); }
public void FizzBuzzMustReportWordsCounts() { string expectedOutput = "1 2 lucky 4 buzz fizz 7 8 fizz buzz 11 fizz lucky 14 fizzbuzz 16 17 fizz 19 buzz" + Environment.NewLine + "fizz: 4" + Environment.NewLine + "buzz: 3" + Environment.NewLine + "fizzbuzz: 1" + Environment.NewLine + "lucky: 2" + Environment.NewLine + "integer: 10"; FizzBuzz fizzBuzz = new FizzBuzz(); Assert.AreEqual(expectedOutput, fizzBuzz.ReportOutput(1, 20)); }
public void FizzBuzzHandlesOutOfMemoryException() { FizzBuzz fizzBuzz = new FizzBuzz(); Assert.Catch< OutOfMemoryException>( delegate { Assert.AreEqual ( "Huge contiguous range. Please select smaller contiguous range.", fizzBuzz.LineOutput(1, int.MaxValue)); }); }
public void FizzBuzzFromOneToTwentyMustOutputLuckyForNumbersContainingThree() { string expectedOutput = @"1 2 lucky 4 buzz fizz 7 8 fizz buzz 11 fizz lucky 14 fizzbuzz 16 17 fizz 19 buzz"; FizzBuzz fizzBuzz = new FizzBuzz(); Assert.AreEqual(expectedOutput, fizzBuzz.LineOutput(1, 20)); }
public void FizzBuzzFromOneToTwenty() { string expectedOutput = @"1 2 lucky 4 buzz fizz 7 8 fizz buzz 11 fizz lucky 14 fizzbuzz 16 17 fizz 19 buzz"; FizzBuzz fizzBuzz = new FizzBuzz(); Assert.AreEqual(expectedOutput, fizzBuzz.LineOutput(1, 20)); }
static void Main(string[] args) { FizzBuzz fizzBuzz = new FizzBuzz(); fizzBuzz.WriteOutput(1, 20); Thread.Sleep(10000); }