예제 #1
0
        public void SelectEfficient_DiceRollsN_ReturnsMax()
        {
            // ARRANGE
            const int diceEdges    = 3;
            const int diceCount    = 1;
            const int expectedRoll = diceEdges * diceCount;  // потому что один бросок кости. Максимальное значение броска - diceEdges.

            var roll = new Roll(diceEdges, diceCount);

            var diceMock = new Mock <IDice>();

            diceMock.Setup(x => x.Roll(It.IsAny <int>())).Returns <int>(n => n);
            var dice = diceMock.Object;

            var service = new TacticalActUsageRandomSource(dice);



            // ACT
            var factRoll = service.RollEfficient(roll);



            // ASSERT
            factRoll.Should().Be(expectedRoll);
        }
예제 #2
0
        public void SelectEfficient_DiceRollsN_ReturnsMax()
        {
            // ARRANGE
            const int minEfficient = 5;
            const int maxEfficient = 10;

            var diceMock = new Mock <IDice>();

            diceMock.Setup(x => x.Roll(It.IsAny <int>())).Returns <int>(n => n);
            var dice = diceMock.Object;

            var service = new TacticalActUsageRandomSource(dice);



            // ACT
            var factRoll = service.SelectEfficient(minEfficient, maxEfficient);



            // ASSERT
            factRoll.Should().Be(maxEfficient);
        }