public void FizzBuzz_When2_Returns2() { int input = 2; string output = FizzBuzzClass.PrintNumber(input); Assert.AreEqual(input.ToString(), output); }
public void Get_Returns_6_For_6() { var fizzBuzz = new FizzBuzzClass(); var result = fizzBuzz.Get(6); Assert.Equal("Fizz", result); }
public void Get_Returns_2_For_2() { var fizzBuzz = new FizzBuzzClass(); var result = fizzBuzz.Get(2); Assert.Equal("2", result); }
public void Get_Returns_5_For_5() { var fizzBuzz = new FizzBuzzClass(); var result = fizzBuzz.Get(5); Assert.Equal("Buzz", result); }
public void Get_Returns_1_For_1() { var fizzBuzz = new FizzBuzzClass(); var result = fizzBuzz.Get(1); Assert.Equal("1", result); }
public void FizzBuzz_When15_ReturnsFizzBuzz() { int input = 15; string output = FizzBuzzClass.PrintNumber(input); Assert.AreEqual("FizzBuzz", output); }
public void Get_Returns_30_For_30() { var fizzBuzz = new FizzBuzzClass(); var result = fizzBuzz.Get(30); Assert.Equal("Fizzbuzz", result); }
public void CanPrintFrom1To100() { FizzBuzzClass fizzBuzz = new FizzBuzzClass(); string expected = @"1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz 16 17 Fizz 19 Buzz Fizz 22 23 Fizz Buzz 26 Fizz 28 29 FizzBuzz 31 32 Fizz 34 Buzz Fizz 37 38 Fizz Buzz 41 Fizz 43 44 FizzBuzz 46 47 Fizz 49 Buzz Fizz 52 53 Fizz Buzz 56 Fizz 58 59 FizzBuzz 61 62 Fizz 64 Buzz Fizz 67 68 Fizz Buzz 71 Fizz 73 74 FizzBuzz 76 77 Fizz 79 Buzz Fizz 82 83 Fizz Buzz 86 Fizz 88 89 FizzBuzz 91 92 Fizz 94 Buzz Fizz 97 98 Fizz Buzz"; var result = fizzBuzz.PrintFizzBuzz(); Assert.AreEqual(expected, result); }
public void CanThrowArgumentExceptionFor101() { int num = 101; FizzBuzzClass fizzBuzz = new FizzBuzzClass(); var exception = Assert.ThrowsException <ArgumentException>(() => fizzBuzz.PrintFizzBuzz(num)); Assert.AreEqual(exception.Message, string.Format("entered number is [{0}], which does not meet rule, entered number should be between 1 to 100.", num)); }
public void ResultArrayReturnsArrayWithNumberStringValues(string expected, int index) { FizzBuzzClass fizzBuzzClass = new FizzBuzzClass(); var results = fizzBuzzClass.FizzBuzzResultArray(); string one = results[index]; Assert.Equal(expected, one); }
public void ResultArrayReturns100Length() { FizzBuzzClass fizzBuzzClass = new FizzBuzzClass(); var result = fizzBuzzClass.FizzBuzzResultArray(); int length = result.Length; Assert.Equal(100, length); }
public void CanHandleLargerValues() { var fbList = new List <string>(); var myFizzBuzz = new FizzBuzzClass(549100, 17, 323, "Mod333", "Mod500"); /* Test edge cases */ fbList = myFizzBuzz.FizzBuzz(); TestCore(fbList, 549100, 17, 323, "Mod333", "Mod500"); }
public void WhenDivisibleBy3And5_PrintFizzBuzz(int index) { FizzBuzzClass fizzBuzzClass = new FizzBuzzClass(); var results = fizzBuzzClass.FizzBuzzResultArray(); string fizzBuzz = results[index]; Assert.Equal("FizzBuzz", fizzBuzz); }
public void ShouldProcess() { FizzBuzzClass fbObj = new FizzBuzzClass(); fbObj.Process(7).Should().Be("7"); fbObj.Process(3).Should().Be("Fizz"); fbObj.Process(5).Should().Be("Buzz"); fbObj.Process(30).Should().Be("FizzBuzz"); }
public void Can_ConstructWith5_CallWith0() { var fbList = new List <string>(); var myFizzBuzz = new FizzBuzzClass(20, 2, 4, "Mod2", "Mod4"); /* Test constructor/default values */ fbList = myFizzBuzz.FizzBuzz(); TestCore(fbList, 20, 2, 4, "Mod2", "Mod4"); }
static void Main(string[] args) { FizzBuzzClass fb = new FizzBuzzClass("Foo", "Bar"); for (int i = 1; i < 101; i++) { Console.WriteLine(fb.GetFizzBuzz(i)); } }
public void Can_ConstructWith0_CallWith3AndMultiples() { var fbList = new List <string>(); var myFizzBuzz = new FizzBuzzClass(); /* Test constructor/default values */ fbList = myFizzBuzz.FizzBuzz(20, 2, 4); TestCore(fbList, 20, 2, 4, FizzBuzzClass.default_string1, FizzBuzzClass.default_string2); }
public void Can_ConstructWith3_CallWith3() { var fbList = new List <string>(); var myFizzBuzz = new FizzBuzzClass(20, 2, 4); /* Test constructor/default values */ fbList = myFizzBuzz.FizzBuzz(50, 5, 10); TestCore(fbList, 50, 5, 10, FizzBuzzClass.default_string1, FizzBuzzClass.default_string2); }
public void CanSuriveNegValues() { var fbList = new List <string>(); var myFizzBuzz = new FizzBuzzClass(); /* Test edge cases */ fbList = myFizzBuzz.FizzBuzz(-1, 1, 0, "X", "Y"); TestCore(fbList, 1, 1, 0, "X", "Y"); }
public void CanTestSingleNumber15() { int num = 15; FizzBuzzClass fizzBuzz = new FizzBuzzClass(); string expected = "FizzBuzz"; var result = fizzBuzz.PrintFizzBuzz(num); Assert.AreEqual(expected, result); }
public void Can_ConstructWith0_CallWith0() { var fbList = new List <string>(); var myFizzBuzz = new FizzBuzzClass(); /* Test constructor/default values */ fbList = myFizzBuzz.FizzBuzz(); TestCore(fbList, FizzBuzzClass.default_upperBound, FizzBuzzClass.default_value1, FizzBuzzClass.default_value2, FizzBuzzClass.default_string1, FizzBuzzClass.default_string2); }
public void TestMethodCustomValues() { FizzBuzzClass fb = new FizzBuzzClass("F", "B"); Assert.AreEqual("F", fb.GetFizzBuzz(3)); Assert.AreEqual("F", fb.GetFizzBuzz(9)); Assert.AreEqual("B", fb.GetFizzBuzz(5)); Assert.AreEqual("B", fb.GetFizzBuzz(10)); Assert.AreEqual("FB", fb.GetFizzBuzz(15)); Assert.AreEqual("1", fb.GetFizzBuzz(1)); }
public void TestMethod() { FizzBuzzClass fb = new FizzBuzzClass(); Assert.AreEqual("Fizz", fb.GetFizzBuzz(3)); Assert.AreEqual("Fizz", fb.GetFizzBuzz(9)); Assert.AreEqual("Buzz", fb.GetFizzBuzz(5)); Assert.AreEqual("Buzz", fb.GetFizzBuzz(10)); Assert.AreEqual("FizzBuzz", fb.GetFizzBuzz(15)); Assert.AreEqual("1", fb.GetFizzBuzz(1)); }
public void FizzBuzz_WhenDivisibleBy3_ReturnsFizz() { var divOnlyBy3Numbers = new List <int> { 3, 6, 9, 12, 18, 21, 24 }; foreach (var input in divOnlyBy3Numbers) { string output = FizzBuzzClass.PrintNumber(input); Assert.AreEqual("Fizz", output); } }
public void FizzBuzz_WhenDivisibleBy5_ReturnsBuzz() { var divOnlyBy5Numbers = new List <int> { 5, 10, 20, 25 }; foreach (var input in divOnlyBy5Numbers) { string output = FizzBuzzClass.PrintNumber(input); Assert.AreEqual("Buzz", output); } }
public void FizzBuzz_WhenDivisibleBy3And5_ReturnsFizzBuzz() { var divBy3And5Numbers = new List <int> { 15, 30, 45, 60, 75, 90 }; foreach (var input in divBy3And5Numbers) { string output = FizzBuzzClass.PrintNumber(input); Assert.AreEqual("FizzBuzz", output); } }
public void FizzBuzz_WhenDefault_Not_ReturnsFizzBuzz() { var defaultNumbers = new List <int> { 1, 2, 4, 7, 8, 11, 13, 14, 16, 17, 19, 22, 23, 26, 28, 29 }; foreach (var input in defaultNumbers) { string output = FizzBuzzClass.PrintNumber(input); Assert.AreNotEqual("FizzBuzz", output); } }
public void FizzBuzz_WhenDefault_ReturnsInputIntegerAsString() { var defaultNumbers = new List <int> { 1, 2, 4, 7, 8, 11, 13, 14, 16, 17, 19, 22, 23, 26, 28, 29 }; foreach (var input in defaultNumbers) { string output = FizzBuzzClass.PrintNumber(input); Assert.AreEqual(input.ToString(), output); } }
public void ManualTestCheck() { var fbList = new List <string>(); var myFizzBuzz = new FizzBuzzClass(); fbList = myFizzBuzz.FizzBuzz(256, 2, 4, "myFizz", "myBuzz"); Assert.That(fbList.ElementAt(1 - 1), Does.Contain("1")); Assert.That(fbList.ElementAt(2 - 1), Does.Contain("myFizz")); Assert.That(fbList.ElementAt(4 - 1), Does.Contain("myFizz")); Assert.That(fbList.ElementAt(4 - 1), Does.Contain("myBuzz")); Assert.That(fbList.ElementAt(8 - 1), Does.Contain("myFizz")); Assert.That(fbList.ElementAt(8 - 1), Does.Contain("myBuzz")); Assert.That(fbList.ElementAt(256 - 1), Does.Contain("myFizz")); Assert.That(fbList.ElementAt(256 - 1), Does.Contain("myBuzz")); Assert.That(fbList.Count, Is.EqualTo(256)); }
static void Main(string[] args) { //instantiate and create new object for class FizzBuzzClass FizzBuzzClass myFizz = new FizzBuzzClass(); //Define what to count to for (int n = 1; n <= 100; n++) { //Create variable and pass n into the Get method string myVar = myFizz.Get(n); //output myVar if meets FizzBuzz.Get method conditions else output number Console.WriteLine(myVar); } //Call Get method from within FizzBuzzClass Console.ReadLine(); }