public void TestPlayerCurrentCellGetterShouldReturnCorrectCell() { ICell cell = new Cell(new Position(1,3)); IPlayer player = new Player("Test", cell); ICell actualCell = player.CurentCell; Assert.AreSame(cell,actualCell); }
/// <summary> /// Method that start the main logic of the game. /// </summary> /// <param name="output">Output renderer</param> /// <param name="input">Iput provider</param> /// <param name="cmmandLogger">Command logger</param> public static void Start(IRenderer output, IInputProvider input, ILogger cmmandLogger) { output.ShowInfoMessage("Please ente your name: "); string playerName = input.GetPlayerName(); output.ShowInfoMessage("Please enter a dimension for the board the standard is 9x9"); int dimension = input.GetPlayFieldDimensions(); ICell playerCell = new Cell(new Position(dimension / 2, dimension / 2)); IPlayField playField = null; var player = new Player.Player(playerName, playerCell); try { var playFieldGenerator = new StandardPlayFieldGenerator(player.CurentCell.Position, dimension, dimension); playField = new PlayField.PlayField(playFieldGenerator, player.CurentCell.Position, dimension, dimension); } catch (ArgumentOutOfRangeException e) { output.ShowInfoMessage(e.Message); } ICommandFactory commandFactory = new SimpleCommandFactory(); IMementoCaretaker memory = new MementoCaretaker(new List<IMemento>()); IScoreLadder ladder = ScoreLadder.Instance; IGameEngine gameEngine = new StandardGameEngine(output, input, playField, commandFactory, cmmandLogger, player,memory,ladder); gameEngine.Initialize(RandomNumberGenerator.Instance); gameEngine.Start(); }
public void TestPlayFieldProperyMustReturnCopyOfPlayfield() { var playField = new Cell[9, 9]; var position = new Position(3, 3); var playFieldMemento = new PlayFieldMemento(playField, position); Assert.AreNotEqual(playFieldMemento, playFieldMemento.PlayField); }
public void TestMementoPlayFieldRowSize() { var position = new Position(0, 1); var cell = new Cell[2, 2]; var mementoField = new PlayFieldMemento(cell, position); Assert.AreEqual(cell.GetLength(0),mementoField.PlayField.GetLength(0)); }
public void TestCloneShouldReturnCellWithSamePositionValues() { Cell cell1 = new Cell(new Position(1, 1)); ICell cell2 = cell1.Clone(); Assert.AreEqual(cell1.Position.Column, cell2.Position.Column); Assert.AreEqual(cell1.Position.Row,cell2.Position.Row); }
public void TestMemmentoWithCorrectData() { var position = new Position(0,1); var cell = new Cell[2,2]; var mementoField = new PlayFieldMemento(cell, position); }
public void TestValidValueForCol() { Cell cell = new Cell(new Position(1, 1)); cell.Position.Column = 5; Assert.AreEqual(cell.Position.Column, 5); }
public void TestValidCharInCell() { Cell cell = new Cell(new Position(1, 1)); cell.ValueChar = Constants.StandardGameCellEmptyValue; cell.ValueChar = Constants.StandardGameCellWallValue; }
public void TestNegativeNumberForRow() { Cell cell = new Cell(new Position(1, 1)); cell.Position.Row = -1; }
public void TestNegativeNumberForCol() { Cell cell = new Cell(new Position(1, 1)); cell.Position.Column = -1; }
public void TestInvalidCharInCell() { Cell cell = new Cell(new Position(1, 1)); cell.ValueChar = '0'; }
public void TestCloneShouldReturnCellWithSameCharValue() { Cell cell1 = new Cell(new Position(1, 1)); ICell cell2 = cell1.Clone(); Assert.AreEqual(cell1.ValueChar, cell2.ValueChar); }
public void TestCloneShouldReturDifferentReference() { Cell cell1 = new Cell(new Position(1,1)); ICell cell2 = cell1.Clone(); Assert.AreNotSame(cell1,cell2); }
public void TestCloneShouldReturCellWithDifferentPositionReference() { Cell cell1 = new Cell(new Position(1, 1)); ICell cell2 = cell1.Clone(); Assert.AreNotSame(cell1.Position, cell2.Position); }
public void TestCheckCellIsEmptyWhenIsNotEmpty() { Cell cell = new Cell(new Position(1, 1)); cell.ValueChar = Constants.StandardGameCellWallValue; Assert.IsFalse(cell.IsEmpty()); }
public void TestValidValueForRow() { Cell cell = new Cell(new Position(1, 1)); cell.Position.Row = 5; Assert.AreEqual(cell.Position.Row, 5); }