public void ExecuteFailsIfCardNotPlayable() { var player = new Mock<IPlayer>(); var game = new Mock<IGame>(); var card = new Mock<IDevelopmentCard>(); card.Setup(c => c.Playable).Returns(false); var command = new PlayDevelopmentCardCommand(player.Object, game.Object, card.Object); Assert.Throws<InvalidOperationException>(() => command.Execute()); }
public void ExecuteTest() { var player = new Mock<IPlayer>(); var game = new Mock<IGame>(); var card = new Mock<IDevelopmentCard>(); card.SetupAllProperties(); card.Setup(c => c.Playable).Returns(true); var command = new PlayDevelopmentCardCommand(player.Object, game.Object, card.Object); command.Execute(); game.Verify(t => t.PlayDevelopmentCard(card.Object)); Assert.True(card.Object.Played); }