Beispiel #1
0
 public void Setup()
 {
     var rules = new List<IRule>();
     rules.Add(new FizzRule());
     rules.Add(new BuzzRule());
     _fizzBuzz = new FizzBuzzGenerator(rules);
 }
Beispiel #2
0
		public void Number_that_is_multiply_of_3_and_5_returns_FizzBuzz()
		{
			var fb = new FizzBuzzGenerator();

			var resut = fb.Transform(15);

			Assert.AreEqual("FizzBuzz", resut);
		}
Beispiel #3
0
		public void Can_transform_number_to_string()
		{
			var fb = new FizzBuzzGenerator();

			var result = fb.Transform(1);

			Assert.AreEqual("1", result);
		}
Beispiel #4
0
		static void Main(string[] args)
		{
			var fb = new FizzBuzzGenerator();
			for ( int i = 1; i < 101; i++ )
			{
				Console.WriteLine(fb.Transform(i));
			}
		}
Beispiel #5
0
        static void Main(string[] args)
        {
            var fizzBuzzGenerator = new FizzBuzzGenerator(_console);

            Console.WriteLine("Welcome to FizzBuzz!\n");
            Console.WriteLine("Starting FizzBuzz...\n");
            fizzBuzzGenerator.Start();

            Console.ReadKey();
        }
Beispiel #6
0
 public static void Main(string[] args)
 {
     FizzBuzzGenerator fizzbizz = new FizzBuzzGenerator ();
     InputParser parser = new InputParser ();
     for (int i = 1; i < 100; i++) {
         int value = parser.Parse (i.ToString ());
         Console.Write(fizzbizz.GetToken (value));
         Console.Write (", ");
     }
     Console.Read ();
 }
        public void FizzBuzzGeneratorShouldPrintValues100Times()
        {
            // Arrange
            _console = MockRepository.GenerateMock<IConsole>();
            var generator = new FizzBuzzGenerator(_console);
            _console.Expect(x => x.Print(Arg<string>.Is.Anything)).Repeat.Times(100);

            // Act
            generator.Start();

            // Assert
            _console.VerifyAllExpectations();
        }
        public void FizzBuzzGeneratorShouldPrintFizzForMultiplesOfThree()
        {
            // Arrange
            _console = MockRepository.GenerateMock<IConsole>();
            var generator = new FizzBuzzGenerator(_console);
            _console.Expect(x => x.Print(Arg<string>.Matches(Is.Equal("Fizz")))).Repeat.AtLeastOnce();

            // Act
            generator.Start();

            // Assert
            _console.VerifyAllExpectations();
        }
Beispiel #9
0
        public void TestMethod1()
        {
            var expected = @"1
            2
            Fizz
            4
            Buzz
            Fizz
            7
            8
            Fizz
            Buzz
            11
            Fizz
            13
            14
            FizzBuzz
            ";

            var serviceUnderTest = new FizzBuzzGenerator();
            var actual = serviceUnderTest.Execute();

            Assert.AreEqual(expected, actual);
        }
Beispiel #10
0
 public void SetUp()
 {
     FizzBuzzGenerator fizzBuzzGenerator = new FizzBuzzGenerator();
     enumerator = fizzBuzzGenerator.GetEnumerator();
 }
Beispiel #11
0
 static void Main(string[] args)
 {
     FizzBuzzGenerator fizzBuzzGenerator = new FizzBuzzGenerator(RulesProvider.GetRules());
     Console.WriteLine(string.Join(Environment.NewLine, fizzBuzzGenerator.Generate(12, 125)));
     Console.Read();
 }