|
using System.Collections.Generic;
using NUnit.Framework;
namespace Bddify.Samples.TicTacToe
{
public class WinnerGame : GameUnderTest
{
private readonly string[] _firstRow;
private readonly string[] _secondRow;
private readonly string[] _thirdRow;
private readonly string _expectedWinner;
public WinnerGame(string[] firstRow, string[] secondRow, string[] thirdRow, string expectedWinner)
{
_firstRow = firstRow;
_secondRow = secondRow;
_thirdRow = thirdRow;
_expectedWinner = expectedWinner;
}
// Note: This method returns IEnumerable<string>
// this is done to allow the method to return its title.
// if you use this method make sure to yield return the title as the very first action
IEnumerable<string> GivenTheFollowingBoard()
{
yield return string.Format(
BoardStateTemplate,
string.Join(", ", _firstRow),
string.Join(", ", _secondRow),
string.Join(", ", _thirdRow));
Game = new Game(_firstRow, _secondRow, _thirdRow);
}
// Note: This method returns IEnumerable<string>
// this is done to allow the method to return its title.
// if you use this method make sure to yield return the title as the very first action
IEnumerable<string> ThenTheWinnerShouldBe()
{
yield return "Then the winner is " + _expectedWinner;
Assert.AreEqual(Game.Winner, _expectedWinner);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.