Skip to content

Instantly share code, notes, and snippets.

@battleguard
Last active December 22, 2015 06:25
Show Gist options
  • Save battleguard/a729d18f35ab7e9973b1 to your computer and use it in GitHub Desktop.
Save battleguard/a729d18f35ab7e9973b1 to your computer and use it in GitHub Desktop.
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 );
}
}
}
@battleguard
Copy link
Author

capture

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment