Created
April 25, 2013 13:15
-
-
Save efleming969/5459602 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using Microsoft.VisualStudio.TestTools.UnitTesting; | |
| using FizzBuzz; | |
| namespace FizzBuzzTests { | |
| [TestClass] | |
| public class GameTest { | |
| [TestMethod] | |
| public void Return_One_For_One() { | |
| var sut = new Game(); | |
| Assert.AreEqual("1", sut.Play(1)); | |
| } | |
| [TestMethod] | |
| public void Return_Two_For_Two() { | |
| var sut = new Game(); | |
| Assert.AreEqual("2", sut.Play(2)); | |
| } | |
| [TestMethod] | |
| public void Return_Fizz_For_Multiples_Of_Three() { | |
| var sut = new Game(); | |
| Assert.AreEqual("fizz", sut.Play(3)); | |
| } | |
| [TestMethod] | |
| public void Return_Fizz_For_Multiples_Of_Three_Refactored() { | |
| var sut = new Game(); | |
| var multiplesOfThree = new int[] { 3, 6, 9, 12, 18, 21, 24, 27, 33, 36, 39, 42, 48, 51, 54, 57 }; | |
| for (int i = 0; i < multiplesOfThree.Length; i++) { | |
| Assert.AreEqual("fizz", sut.Play(multiplesOfThree[i])); | |
| } | |
| } | |
| [TestMethod] | |
| public void Return_Buzz_For_Multiples_Of_Five() { | |
| var sut = new Game(); | |
| var multiplesOfFive = new int[] { 5, 10, 20, 25, 35, 40, 50, 55 }; | |
| for (int i = 0; i < multiplesOfFive.Length; i++) { | |
| Assert.AreEqual("buzz", sut.Play(multiplesOfFive[i])); | |
| } | |
| } | |
| [TestMethod] | |
| public void Return_FizzBuzz_For_Multiples_Of_Three_And_Five() { | |
| var sut = new Game(); | |
| var multiplesOfThreeAndFive = new int[] { 15, 30, 45, 60 }; | |
| for (int i = 0; i < multiplesOfThreeAndFive.Length; i++) { | |
| Assert.AreEqual("fizzbuzz", sut.Play(multiplesOfThreeAndFive[i])); | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment