public void ShouldNotIncreaseHealthMoreThanMaxHealth_WhenPurchased() { var originalPlayer = PlayerFixture.CreateDefaultPlayer(maxHealth: 100, health: 95); var(actualPlayer, options) = MakePurchase(originalPlayer); actualPlayer.Health.Should() .Be(originalPlayer.MaxHealth); actualPlayer.Coins.Should() .Be(originalPlayer.Coins - options.Price); }
public void ShouldIncreasePower_WhenPurchase() { var originalPlayer = PlayerFixture.CreateDefaultPlayer(); var(actualPlayer, options) = MakePurchase(originalPlayer); actualPlayer.Power.Should() .Be(originalPlayer.Power + options.MaxValue); actualPlayer.Coins.Should() .Be(originalPlayer.Coins - options.Price); }
private THandler CreateSut( Player player = null, IPlayerStore playerStore = null, IRandom random = null, TOptions options = null) { player = player ?? PlayerFixture.CreateDefaultPlayer(); playerStore = playerStore ?? Substitute.For <IPlayerStore>(); playerStore.GetPlayer().Returns(player); random = random ?? Substitute.For <IRandom>(); var opts = Substitute.For <IOptions <TOptions> >(); opts.Value.Returns(options ?? new TOptions()); return(CreateSutImpl(playerStore, random, opts)); }
private static AttackCommandHandler CreateSut( Player player = null, IPlayerStore playerStore = null, IRandom random = null, IFormulaCalculator calculator = null, AttackOptions options = null) { player = player ?? PlayerFixture.CreateDefaultPlayer(); playerStore = playerStore ?? Substitute.For <IPlayerStore>(); playerStore.GetPlayer().Returns(player); random = random ?? Substitute.For <IRandom>(); calculator = calculator ?? Substitute.For <IFormulaCalculator>(); var optionsSnapshot = Substitute.For <IOptionsSnapshot <AttackOptions> >(); optionsSnapshot.Value.Returns(options ?? new AttackOptions()); return(new AttackCommandHandler(playerStore, random, calculator, optionsSnapshot)); }