public void SimpleFizzBuzzer_WhenRanWithAppropriateData_ShouldReturnExpectedResults() { var result = new FizzBuzzerImpl().Start(1, 15, 3, 5); Assert.IsTrue(result.Count() == 16); //should be 16 items Assert.IsTrue(result.Count(x => x == "Fizz") == 5); //should have 5 instances of Fizz Assert.IsTrue(result.Count(x => x == "Buzz") == 3); //should have 3 instances of Buzz }
public void FizzBuzzer_WhenRanWithAppropriateData_ShouldReturnExpectedResults() { var result = new FizzBuzzerImpl().Start(1, 120, new Dictionary <int, string>() { { 3, "Fizz" }, { 5, "Buzz" }, { 8, "Wizz" } }); //should return number of items equal to count of items from X to Y Assert.IsTrue(result.Count() == 120); //should contain X number of 3 var fizzCnt = result.Count(x => x.Trim() == "Fizz"); Assert.IsTrue(fizzCnt == 28); //should contain X number of 5 var buzzCnt = result.Count(x => x.Trim() == "Buzz"); Assert.IsTrue(buzzCnt == 14); //should contain X number of 8 var wizzCnt = result.Count(x => x.Trim() == "Wizz"); Assert.IsTrue(wizzCnt == 8); //should contain X number of 3 and 5 var fizzBuzzCnt = result.Count(x => x.Trim() == "Fizz Buzz"); Assert.IsTrue(fizzBuzzCnt == 7); //should contain X number of 5 and 8 var buzzWizzCnt = result.Count(x => x.Trim() == "Buzz Wizz"); Assert.IsTrue(buzzWizzCnt == 2); //should contain X number of 3 and 8 var fizzWizzCnt = result.Count(x => x.Trim() == "Fizz Wizz"); Assert.IsTrue(fizzWizzCnt == 4); //should contain X number of 3 and 5 and 8 var fizzBuzzWizzCnt = result.Count(x => x.Trim() == "Fizz Buzz Wizz"); Assert.IsTrue(fizzBuzzWizzCnt == 1); }