public void ShouldKeepFirstDie() { var die1 = new Mock <Die>(); var die2 = new Mock <Die>(); Dice sut = new DiceImplemented(die1.Object, die2.Object, die2.Object, die2.Object, die2.Object); sut.KeepDie(DiceList.Die1); sut.Throw(); die1.Verify(die => die.Throw(), Times.Never()); die2.Verify(die => die.Throw(), Times.AtLeastOnce()); }
public void ShouldKeepMultipleDice() { var keep1 = new Mock <Die>(); var keep2 = new Mock <Die>(); var die = new Mock <Die>(); Dice sut = new DiceImplemented(keep1.Object, die.Object, keep2.Object, die.Object, die.Object); sut.KeepDie(DiceList.Die1); sut.KeepDie(DiceList.Die3); sut.Throw(); keep1.Verify(d => d.Throw(), Times.Never()); keep2.Verify(d => d.Throw(), Times.Never()); die.Verify(d => d.Throw(), Times.AtLeastOnce()); }
public void ShouldNotBeEffectedOfKeepingDieMultipleTimes() { var die = new Mock <Die>(); var keep = new Mock <Die>(); Dice sut = new DiceImplemented(die.Object, die.Object, keep.Object, die.Object, die.Object); sut.KeepDie(DiceList.Die3); sut.KeepDie(DiceList.Die3); sut.KeepDie(DiceList.Die3); sut.KeepDie(DiceList.Die3); sut.Throw(); keep.Verify(d => d.Throw(), Times.Never()); die.Verify(d => d.Throw(), Times.Once()); }
public void ShouldThrowAllDice() { var die1 = new Mock <Die>(); var die2 = new Mock <Die>(); var die3 = new Mock <Die>(); var die4 = new Mock <Die>(); var die5 = new Mock <Die>(); Dice sut = new DiceImplemented(die1.Object, die2.Object, die3.Object, die4.Object, die5.Object); sut.Throw(); die1.Verify(die => die.Throw(), Times.Once()); die2.Verify(die => die.Throw(), Times.Once()); die3.Verify(die => die.Throw(), Times.Once()); die4.Verify(die => die.Throw(), Times.Once()); die5.Verify(die => die.Throw(), Times.Once()); }