public void SetCallbacks(IBoardActions instance) { if (m_Wrapper.m_BoardActionsCallbackInterface != null) { @Click.started -= m_Wrapper.m_BoardActionsCallbackInterface.OnClick; @Click.performed -= m_Wrapper.m_BoardActionsCallbackInterface.OnClick; @Click.canceled -= m_Wrapper.m_BoardActionsCallbackInterface.OnClick; @Point.started -= m_Wrapper.m_BoardActionsCallbackInterface.OnPoint; @Point.performed -= m_Wrapper.m_BoardActionsCallbackInterface.OnPoint; @Point.canceled -= m_Wrapper.m_BoardActionsCallbackInterface.OnPoint; @RightClick.started -= m_Wrapper.m_BoardActionsCallbackInterface.OnRightClick; @RightClick.performed -= m_Wrapper.m_BoardActionsCallbackInterface.OnRightClick; @RightClick.canceled -= m_Wrapper.m_BoardActionsCallbackInterface.OnRightClick; @EscapeMenu.started -= m_Wrapper.m_BoardActionsCallbackInterface.OnEscapeMenu; @EscapeMenu.performed -= m_Wrapper.m_BoardActionsCallbackInterface.OnEscapeMenu; @EscapeMenu.canceled -= m_Wrapper.m_BoardActionsCallbackInterface.OnEscapeMenu; } m_Wrapper.m_BoardActionsCallbackInterface = instance; if (instance != null) { @Click.started += instance.OnClick; @Click.performed += instance.OnClick; @Click.canceled += instance.OnClick; @Point.started += instance.OnPoint; @Point.performed += instance.OnPoint; @Point.canceled += instance.OnPoint; @RightClick.started += instance.OnRightClick; @RightClick.performed += instance.OnRightClick; @RightClick.canceled += instance.OnRightClick; @EscapeMenu.started += instance.OnEscapeMenu; @EscapeMenu.performed += instance.OnEscapeMenu; @EscapeMenu.canceled += instance.OnEscapeMenu; } }
public UndoBoard(IBoardActions boardActions, IBoardQuery boardQuery, Mover fancy, Mover simple, Mover instant) { if (fancy == null) { throw new ArgumentNullException("fancy"); } if (simple == null) { throw new ArgumentNullException("simple"); } if (instant == null) { throw new ArgumentNullException("instant"); } if (boardQuery == null) { throw new ArgumentNullException("boardQuery"); } if (boardActions == null) { throw new ArgumentNullException("boardActions"); } this.fancy = fancy; this.simple = simple; this.instant = instant; this.boardQuery = boardQuery; this.boardActions = boardActions; }
public void MakeAMove_IncrementsTotalMoves_Test() { _board = new Board(); var startCounter = _board.TotalMovesMade; _board.MakeAMove(_noughts, _board.GetRandomChoice()); Assert.IsTrue(_board.TotalMovesMade == ++startCounter, "Total moves made didnt increment as expected"); }
public void KnotsSquares_UpdatesAfterMoves_Test() { _board = new Board(); var startCounter = _board.TotalMovesMade; _board.MakeAMove(_noughts, _board.GetRandomChoice()); Assert.IsTrue(_board.NoughtsSquares.Count() == ++startCounter, "Noughts moves made didnt increment as expected"); }
public void GetSquare_AfterUpdateCorrectResult_Test() { _board = new Board(); var choice = _board.GetRandomChoice(); _board.MakeAMove(_noughts, choice); Assert.IsTrue(_board.GetSquare(choice) == Board.SquareState.Noughts, "Correctly obtaining the square after update"); }
public void MakeAMove_InvalidMove_Test() { _board = new Board(); var choice = _board.GetRandomChoice(); _board.MakeAMove(_noughts, choice); Assert.Throws<InvalidMoveException>(() => _board.MakeAMove(_noughts, choice), "Performing the same move twice should have thrown an InvalidMoveException"); }
ScoreBoard InstallScoreBoard(IBoardActions boardActions, IBoardQuery boardQuery) { var undoBoard = new UndoBoard(boardActions, boardQuery, new MoverRotateAsync(), new MoverSlideAsync(), new MoverImmediate()); var scoreBoard = new ScoreBoard(undoBoard, undoBoard); return(scoreBoard); }
public void MakeAMove_InvalidMove_Test() { _board = new Board(); var choice = _board.GetRandomChoice(); _board.MakeAMove(_noughts, choice); Assert.Throws <InvalidMoveException>(() => _board.MakeAMove(_noughts, choice), "Performing the same move twice should have thrown an InvalidMoveException"); }
public void StartNewGame() { _gameBoard = new Board(); TotalGames++; }
public void GetSquare_CorrectResult_Test() { _board = new Board(); Assert.IsTrue(_board.GetSquare(0, 0) == Board.SquareState.Unchecked, "Correctly obtaining the square after update"); }
public void GetSquare_OutOfBounds_Test() { _board = new Board(); Assert.Throws <IndexOutOfRangeException>(() => _board.GetSquare(4, 4), "Trying to get a square out of bounds didnt throw an exception?"); }
public GameBoardFactory(IBroadcastService broadcastService, IBoardActions boardActions) { this.broadcastService = broadcastService; this.boardActions = boardActions; }
public void GetSquare_OutOfBounds_Test() { _board = new Board(); Assert.Throws<IndexOutOfRangeException>(() => _board.GetSquare(4, 4), "Trying to get a square out of bounds didnt throw an exception?"); }
public GameBoard(string boardName, IBroadcastService broadcastService, IBoardActions boardActions) { this.Name = boardName; this.broadcastService = broadcastService; this.boardActions = boardActions; }
public ShootGameCommandHandler(IBoardManager boardManager, IBroadcastService broadcastService, IBoardActions boardActions) { this.boardManager = boardManager; this.broadcastService = broadcastService; this.boardActions = boardActions; }