Пример #1
0
        public void Should_throw_exception_when_num_dynamite_greater_than_num_games()
        {
            // Arrange

            // Act && Assert
            rpsPlayer.Invoking(async r => await r.GetReady(1, 10))
            .Should().Throw <Exception>().WithMessage(Constants.InvalidNumberOfDynamite);
        }
        public void Should_throw_exception_if_no_match_in_progress()
        {
            // Arrange
            rpsGameStore.GetGame().ReturnsNull();

            // Act & Assert
            rpsPlayer.Invoking(async r => await r.MakeMove()).Should().Throw <Exception>().WithMessage(Constants.NoMatchInProgress);
        }
        public void Should_throw_exception_if_no_game_in_progress()
        {
            // Arrange
            var newRpsGame = new RPSGame(10, 0);

            rpsGameStore.GetGame().Returns(newRpsGame);

            // Act && Assert
            rpsPlayer.Invoking(async r => await r.GameResult(Outcome.Win, Move.Rock))
            .Should().Throw <Exception>().WithMessage(Constants.NoGameProgress);
        }
        public async Task Should_throw_exception_if_not_all_games_completed()
        {
            // Arrange
            var newRpsGame = new RPSGame(10, 1);

            rpsGameStore.GetGame().Returns(newRpsGame);

            // Act && Assert
            rpsPlayer.Invoking(async r => await r.Result(Outcome.Win))
            .Should().Throw <Exception>().WithMessage(Constants.NotAllGamesCompleted);
        }