Example #1
0
 static void Main(string[] args)
 {
     var fb = new FizzBuzz(2000000000);
     foreach (var item in fb.All())
     {
         Console.WriteLine(item);
     };
     Console.ReadKey();
 }
Example #2
0
        public void Get_WhenRulesHaveBeenCleared_AlwaysReturnsTheNumber()
        {
            var fb = new FizzBuzz(15);
            fb.Rules.Clear();

            for (UInt64 i = 1; i <= fb.countTo; i++)
            {
                Assert.AreEqual(i.ToString(), fb.Get(i));
            }
        }
Example #3
0
 public void Get_WithDefaultRulesAnd15_ReturnsFizzBuzz()
 {
     var fb = new FizzBuzz();
     Assert.AreEqual("fizzbuzz", fb.Get(15));
 }
Example #4
0
 public void Get_GivenValueLessThanStartFrom_ThrowsException()
 {
     var fb = new FizzBuzz();
     fb.Get(0);
 }
Example #5
0
 public void Get_GivenZeroAppropriately_WillReturnCorrectResult()
 {
     var fb = new FizzBuzz(1,0);
     Assert.AreEqual("fizzbuzz", fb.Get(0));
 }
Example #6
0
 public void Get_GivenUInt64MaxAppropriately_WillReturnCorrectResult()
 {
     var fb = new FizzBuzz(UInt64.MaxValue);
     Assert.AreEqual("fizzbuzz", fb.Get(UInt64.MaxValue));
 }
Example #7
0
 public void Get_GivenValueGreaterThanCountTo_ThrowsException()
 {
     var fb = new FizzBuzz();
     fb.Get(101);
 }
Example #8
0
 public void FizzBuzzConstructor_GivenOneArgument200_WillCountFrom1To200()
 {
     var fb = new FizzBuzz(200);
     Assert.AreEqual(1, fb.startFrom);
     Assert.AreEqual(200, fb.countTo);
 }
Example #9
0
 public void FizzBuzzConstructor_GivenTwoArguments300And5_WillCountFrom5To300()
 {
     var fb = new FizzBuzz(300,5);
     Assert.AreEqual(5, fb.startFrom);
     Assert.AreEqual(300, fb.countTo);
 }
Example #10
0
 public void FizzBuzzConstructor_GivenCountToLessThanStartFrom_ThrowsException()
 {
     var fb = new FizzBuzz(1, 2);
 }
Example #11
0
 public void FizzBuzzConstructor_GivenNoArguments_WillCountFrom1To100()
 {
     var fb = new FizzBuzz();
     Assert.AreEqual(1, fb.startFrom);
     Assert.AreEqual(100, fb.countTo);
 }
Example #12
0
 public void Get_WithNewApplicableRuleInsertedAtStart_ReturnsPopFizzBuzz()
 {
     var fb = new FizzBuzz();
     fb.Rules.Insert(0, new Rule(2, "pop"));
     Assert.AreEqual("popfizzbuzz", fb.Get(30));
 }
Example #13
0
 public void Get_WithNewApplicableRuleAtEnd_ReturnsFizzBuzzPop()
 {
     var fb = new FizzBuzz();
     fb.Rules.Add(new Rule(2, "pop"));
     Assert.AreEqual("fizzbuzzpop", fb.Get(30));
 }
Example #14
0
 public void Get_WithNewApplicableDuplicateRuleAtEnd_ReturnsFizzBuzzPopBang()
 {
     var fb = new FizzBuzz();
     fb.Rules.Add(new Rule(2, "pop"));
     fb.Rules.Add(new Rule(2, "bang"));
     Assert.AreEqual("fizzbuzzpopbang", fb.Get(30), "Expected both 'duplicate' rules to apply.");
 }
Example #15
0
 public void Get_WithDefaultRulesAndCountToValue_ReturnsFizzBuzz()
 {
     var fb = new FizzBuzz();
     Assert.AreEqual("buzz", fb.Get(fb.countTo), "expected that the countTo value (which should be the top bound) would return a valid string result.");
 }
Example #16
0
 public void Get_WithDefaultRulesAnd1_Returns1()
 {
     var fb = new FizzBuzz();
     Assert.AreEqual("1", fb.Get(1));
 }