public GameBoardViewModel PlayGame(Move playerMove)
        {
            var generatedMove = _computerMoveGenerator.GenerateComputerMove();

            var result = _gameResolver.ResolveGame(playerMove, generatedMove);

            return new GameBoardViewModel(result);
        }
Ejemplo n.º 2
0
        public void GameServicePassesMoveFromPlayerToGameResolver()
        {
            var playerMove = new Move();

            var classUnderTest = BuildUpClassUnderTest();

            classUnderTest.PlayGame(playerMove);

            Assert.That(_move1PassedToResolver, Is.SameAs(playerMove));
        }
Ejemplo n.º 3
0
        public void WhenResultIsDrawConfiguresViewAsDraw()
        {
            _moveToReturnFromMoveGenerator = new Move();
            _gameResultToReturnFromResolver = new DrawnGame(string.Empty);

            var classUnderTest = BuildUpClassUnderTest();

            var result = classUnderTest.PlayGame(new Move());

            Assert.That(result.IsDraw, Is.True);
        }
Ejemplo n.º 4
0
        public void GameServicePassesMoveFromMoveGeneratorToGameResolver()
        {
            _moveToReturnFromMoveGenerator = new Move();
            _gameResultToReturnFromResolver = new FakeGameResult();

            var classUnderTest = BuildUpClassUnderTest();

            classUnderTest.PlayGame(new Move());

            Assert.That(_move2PassedToResolver, Is.SameAs(_moveToReturnFromMoveGenerator));
        }
        public void BuildsCorrectlyFromAWinGame()
        {
            var winninMove = new Move();
            var losingMove = new Move();
            const string winSummary = "Win";

            var result = new WinGame(winninMove, losingMove, winSummary);

            var classUnderTest = new GameBoardViewModel(result);

            Assert.That(classUnderTest.WinnerMove, Is.SameAs(winninMove));
            Assert.That(classUnderTest.LosingMove, Is.SameAs(losingMove));
            Assert.That(classUnderTest.ResultText, Is.EqualTo(winSummary));
            Assert.That(classUnderTest.IsDraw, Is.False);
        }
Ejemplo n.º 6
0
 public void GivenTheComputerWillPayScissors(Weapon weaponType)
 {
     ComputerMove = new Move() { PlayerName = "Computer", WeaponType = weaponType };
 }
Ejemplo n.º 7
0
 public void GivenPlaysRock(string playerName, Weapon weaponType)
 {
     PlayerMove = new Move() {PlayerName = playerName, WeaponType = weaponType};
 }
 public GameBoardViewModel PlayGame(Move playerMove)
 {
     _movedPassedToGameService = playerMove;
     return _responseFromGameService;
 }
Ejemplo n.º 9
0
 public GameResult ResolveGame(Move move1, Move move2)
 {
     _move1PassedToResolver = move1;
     _move2PassedToResolver = move2;
     return _gameResultToReturnFromResolver;
 }
 private Move GenerateMove(Weapon weaponType)
 {
     var move = new Move() { PlayerName = "Player1", WeaponType = weaponType};
     return move;
 }