public void TestIfResetMethodCorrectlyResetsTheUserMovesCount() { var gameModel = new Game(new GameLogic(MatrixValidator.GetInstance)); gameModel.IncrementMoves(); gameModel.Reset(); Assert.AreEqual(0, gameModel.UserMovesCount); }
public static void Main() { var consoleUI = new ConsoleUI(); var commandFactory = new CommandFactory(); var gameLogicProvider = new GameLogic(MatrixValidator.GetInstance); var gameModel = new Game(gameLogicProvider); var engine = new Engine(consoleUI, UserInputValidator.GetInstance, commandFactory, gameModel, gameLogicProvider); engine.Run(); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); var graphicUi = new MainWindow(); var factory = new CommandFactory(); var validator = MatrixValidator.GetInstance; var logicProvider = new GameLogic(validator); var model = new Game(logicProvider); this.engine = new GraphicEngine(graphicUi, UserInputValidator.GetInstance, factory, model, logicProvider); graphicUi.Show(); }
public void TestIfResetMethodResetsTheGameFieldCorrectly() { var gameModel = new Game(new GameLogic(MatrixValidator.GetInstance)); var fieldBeforeReset = (byte[,])gameModel.Field.Clone(); gameModel.Reset(); var differentFieldCount = 0; for (int i = 0; i < fieldBeforeReset.GetLength(0); i++) { for (int j = 0; j < fieldBeforeReset.GetLength(1); j++) { if (fieldBeforeReset[i, j] != gameModel.Field[i, j]) { differentFieldCount++; } } } Assert.IsTrue(gameModel.Field.Length / differentFieldCount < 2); }
public void TestIfInitialMovesCountIsZero() { var gameModel = new Game(new GameLogic(MatrixValidator.GetInstance)); Assert.AreEqual(0, gameModel.UserMovesCount); }
public void TestIfGameModelIsCreatedWithInitializedField() { var gameModel = new Game(new GameLogic(MatrixValidator.GetInstance)); Assert.IsNotNull(gameModel.Field); }