示例#1
0
        public void ExpectNoDistributeIfDiceResult7()
        {
            var player = new Mock<IPlayer>();
            var dice = new Mock<IDice>();
            var provider = new Mock<IRawmaterialProvider>();
            dice.Setup(d => d.Current).Returns(new DiceRoll(new int[] { 7 }));

            var command = new RollDiceCommand(player.Object, dice.Object, provider.Object);
            command.Execute();

            provider.Verify(p => p.Distribute(It.IsAny<int>()), Times.Never);
        }
示例#2
0
        public void ExecuteProvidesMaterialsIfResultNot7(int value)
        {
            var player = new Mock<IPlayer>();
            var dice = new Mock<IDice>();
            var provider = new Mock<IRawmaterialProvider>();

            dice.Setup(d => d.Current).Returns(new DiceRoll(new int[] { value }));

            var command = new RollDiceCommand(player.Object, dice.Object, provider.Object);
            command.Execute();

            dice.Verify(d => d.Roll());
            provider.Verify(p => p.Distribute(value), Times.Once);
        }