How Stupid Should i Be when Passing tests in TDD

Example,

public void PlayGame_ThreeAsInput_OutputIsFizz()
{
//arrange
int num = 3;
//act
var methodResult = _fizzBussApplication.PlayGame(num);
//assert
Assert.Matches("Fizz",methodResult);
}

So I made my test and it fails because the method only returns an empty string

public string PlayGame(int Number)
{

 `return "";` `}` 

I know in TDD i should only write as much code to pass the failing test, so should i write

public string PlayGame(int Number)
{

 `return "3";` `}` 

or

public string PlayGame(int Number)
{
if (Number == 3)
{
return "Fizz";
}
return "";
}

Or should i use a little more brain power and actually implement the fizz function properly ie

public string PlayGame(int Number)
{
if (Number % 3 == 0)
{
return "Fizz";
}
return "";
}

Or am i writing the wrong tests?

Thank you for any advice new to TDD and have an interview tomorrow

submitted by /u/-l—-l–__–
[link] [comments]

from Software Development – methodologies, techniques, and tools. Covering Agile, RUP, Waterfall + more! https://ift.tt/Pnd7lui

Leave a comment

Design a site like this with WordPress.com
Get started
search previous next tag category expand menu location phone mail time cart zoom edit close