コード例 #1
0
 private static IGameBuilder BuildGameBuilder(IStartingPlayerMapper startingPlayerMapper = null,
                                              IPlayers players           = null,
                                              IBoardService boardService = null,
                                              int?size = null,
                                              IPlayerType firstPlayerType    = null,
                                              IPlayerType secondPlayerType   = null,
                                              IStartingPlayer startingPlayer = null)
 {
     startingPlayerMapper = startingPlayerMapper ?? new MockStartingPlayerMapper().AddReturnsItself();
     players          = players ?? new MockPlayers().AddReturnsItself();
     boardService     = boardService ?? new MockBoardService();
     size             = size ?? 3;
     firstPlayerType  = firstPlayerType ?? new MockPlayerType();
     secondPlayerType = secondPlayerType ?? new MockPlayerType();
     startingPlayer   = startingPlayer ?? new MockStartingPlayer();
     return(GameBuilder
            .Initialize(startingPlayerMapper, players, boardService)
            .WithBoardSize(size.Value)
            .FirstPlayerSet(firstPlayerType)
            .SecondPlayerSet(secondPlayerType)
            .Set(startingPlayer));
 }
コード例 #2
0
 public IStartingPlayerMapper Add(IStartingPlayer startingPlayer, IPlayer player) => _mock.Object.Add(startingPlayer, player);
コード例 #3
0
 public IPlayer this[IStartingPlayer key] => _mock.Object[key];
コード例 #4
0
 public void VerifyKeyCalled(IStartingPlayer startingPlayer, int times = 1)
 {
     _mock.Verify(m => m[startingPlayer], Times.Exactly(times));
 }
コード例 #5
0
 public void VerifyAddCalled(IStartingPlayer startingPlayer, IPlayer player, int times = 1)
 {
     _mock.Verify(m => m.Add(startingPlayer, player), Times.Exactly(times));
 }
コード例 #6
0
 public IGameBuilder Set(IStartingPlayer startingPlayer)
 {
     _players = _players.SetCurrentPlayer(_startingPlayerMapper[startingPlayer]);
     return(this);
 }