66 lines
1.8 KiB
C#

using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using Week_11___TTTLib;
namespace Week_11___TTTTests
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
}
[TestMethod]
public void TestEmptyArray()
{
IGameWinnerService gameWinnerService;
gameWinnerService = new GameWinnerService();
const char expected = ' ';
var gameboard = new char[,]
{
{' ', ' ', ' ' },
{' ', ' ', ' ' },
{' ', ' ', ' ' }
};
var actual = gameWinnerService.Validate(gameboard);
Assert.AreEqual(expected, actual);
}
[TestMethod]
public void TestPlayerWithAllCrossesInTopRowIsWinner()
{
IGameWinnerService gameWinnerService;
gameWinnerService = new GameWinnerService();
const char expected = 'X';
var gameboard = new char[,]
{
{'X', 'X', 'X' },
{' ', ' ', ' ' },
{' ', ' ', ' ' }
};
var actual = gameWinnerService.Validate(gameboard);
Assert.AreEqual(expected, actual);
}
[TestMethod]
public void TestPlayerWithAllNaughtsInTopRowIsWinner()
{
IGameWinnerService gameWinnerService;
gameWinnerService = new GameWinnerService();
const char expected = 'O';
var gameboard = new char[,]
{
{'O', 'O', 'O' },
{' ', ' ', ' ' },
{' ', ' ', ' ' }
};
var actual = gameWinnerService.Validate(gameboard);
Assert.AreEqual(expected, actual);
}
}
}