Last active
December 22, 2015 06:25
-
-
Save battleguard/a729d18f35ab7e9973b1 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 NUnit.Framework; | |
| namespace Project | |
| { | |
| public static class FizzBuzz | |
| { | |
| public static string Compute( int inputNumber ) | |
| { | |
| if ( inputNumber % 3 == 0 && inputNumber % 5 == 0 ) | |
| return "FizzBuzz"; | |
| if ( inputNumber % 3 == 0 ) | |
| return "Fizz"; | |
| if ( inputNumber % 5 == 0 ) | |
| return "Buzz"; | |
| return inputNumber.ToString(); | |
| } | |
| } | |
| public class UnitTest1 | |
| { | |
| [TestCase( 1, ExpectedResult = "1")] | |
| [TestCase( 2, ExpectedResult = "2")] | |
| [TestCase( 3, ExpectedResult = "Fizz")] | |
| [TestCase( 5, ExpectedResult = "Buzz")] | |
| [TestCase( 6, ExpectedResult = "Fizz")] | |
| [TestCase( 10, ExpectedResult = "Buzz")] | |
| [TestCase( 15, ExpectedResult = "FizzBuzz" )] | |
| public string TestFizzBuzz( int input ) | |
| { | |
| return FizzBuzz.Compute( input ); | |
| } | |
| } | |
| } |
Author
battleguard
commented
Dec 22, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment