using System.Collections;
using System.Collections.Generic;
namespace SeeBatleGameWithTest.Tests
public class PlayerFixture
[TestCase("A1", ShotResult.Past, CellState.AffectedEmpty)]
[TestCase("B2", ShotResult.Injured, CellState.AffectedDeck)]
[TestCase("C3", ShotResult.Affected, CellState.AffectedDeck)]
[TestCase("D4", ShotResult.Killed, CellState.AffectedDeck)]
public void ShouldSetCellState(string stringCoordinate, ShotResult result, CellState expected)
var testPlayer = CreateInstance();
var coordinateOfShot = Coordinate.DefineCoordinateFromString(stringCoordinate);
testPlayer.SetShotsResult(coordinateOfShot, result);
var actual = testPlayer.Board_2.Cells.Find(cell => cell.Address == coordinateOfShot).State;
Assert.AreEqual(expected, actual);
[TestCaseSource(typeof(PlayerFixture), "TestCases")]
public CellState ShouldSetCellState(Coordinate coordinateOfShot, ShotResult result)
var testPlayer = CreateInstance();
testPlayer.SetShotsResult(coordinateOfShot, result);
var actual = testPlayer.Board_2.Cells.Find(cell => cell.Address == coordinateOfShot).State;
public static IEnumerable TestCases
yield return new TestCaseData(new Coordinate(AddressLetter.A, AddressNumber.One), ShotResult.Past).Returns(CellState.AffectedEmpty);
yield return new TestCaseData(new Coordinate(AddressLetter.B, AddressNumber.Two), ShotResult.Injured).Returns(CellState.AffectedDeck);
yield return new TestCaseData(new Coordinate(AddressLetter.C, AddressNumber.Three), ShotResult.Affected).Returns(CellState.AffectedDeck);
yield return new TestCaseData(new Coordinate(AddressLetter.D, AddressNumber.Four), ShotResult.Killed).Returns(CellState.AffectedDeck);
private Player CreateInstance()
Player testPlayer = new Player("TestPlayer");
public static IEnumerable TestCases
yield return new TestCaseData(new Coordinate(AddressLetter.A, AddressNumber.One), ShotResult.Past).Returns(CellState.AffectedEmpty);
yield return new TestCaseData(new Coordinate(AddressLetter.B, AddressNumber.Two), ShotResult.Injured).Returns(CellState.AffectedDeck);
yield return new TestCaseData(new Coordinate(AddressLetter.C, AddressNumber.Three), ShotResult.Affected).Returns(CellState.AffectedDeck);
yield return new TestCaseData(new Coordinate(AddressLetter.D, AddressNumber.Four), ShotResult.Killed).Returns(CellState.AffectedDeck);