public void Should_throw_TileUnavailableException(int tileId) { var gameData = CreateData(); gameData.Tiles = Enumerable.Range(0, 9) .Select(x => new Tile { TileId = x, Card = x == tileId ? new TileCard(AllCards.Squall, false) : null }); var gameResultService = new Mock <IGameResultService>(); var ruleStrategyFactory = new Mock <IRuleStrategyFactory>(); var subject = new PlayCardHandler( gameResultService.Object, ruleStrategyFactory.Object); Action act = () => subject.ValidateAndThrow(CreateStep(gameData, tileId: tileId)); act.Should() .Throw <TileUnavailableException>() .Where(x => x.GameData == gameData && x.TileId == tileId); }
public void Should_throw_NotPlayerTurnException(bool isHost) { var gameData = CreateData(!isHost); var gameResultService = new Mock <IGameResultService>(); var ruleStrategyFactory = new Mock <IRuleStrategyFactory>(); var subject = new PlayCardHandler( gameResultService.Object, ruleStrategyFactory.Object); Action act = () => subject.ValidateAndThrow(CreateStep(gameData, isHost: isHost, cardName: MissingCardName)); act.Should() .Throw <NotPlayerTurnException>() .Where(x => x.GameData == gameData && x.IsHost == isHost); }