コード例 #1
0
        public void ShouldMarkCellsWithShip()
        {
            var shipPlacement = _fixture.Create <ShipPlacement>();

            var shipPositions = _fixture.CreateMany <(char, int)>().ToList();

            _battleshipPlacement.Setup(x => x.GetShipPositions(shipPlacement))
            .Returns(shipPositions);

            _battleship.Place(_battlefield.Object, shipPlacement);

            foreach (var positions in shipPositions)
            {
                _battlefield.Verify(x => x.MarkCell(positions), Times.Once);
            }

            _battlefield.Verify(x => x.MarkCell(It.IsAny <(char, int)>()), Times.Exactly(shipPositions.Count));
        }