Ejemplo n.º 1
0
        public void ShouldMarkShipAsSunkForGivenCollectionNextPointWillBeRandomGenerated()
        {
            var shipDataGeneratorMock = new Mock <IShipDataGenerator>();

            shipDataGeneratorMock.Setup(m => m.GetDirection()).Returns(1);
            var botLogic = new BotLogic(shipDataGeneratorMock.Object);


            botLogic.StoreLastStatus(Coordinate.FromIndex(1, 0), Status.Miss);
            botLogic.StoreLastStatus(Coordinate.FromIndex(1, 1), Status.Hit);
            botLogic.StoreLastStatus(Coordinate.FromIndex(2, 1), Status.Hit);
            botLogic.StoreLastStatus(Coordinate.FromIndex(3, 1), Status.Hit);
            botLogic.StoreLastStatus(Coordinate.FromIndex(0, 1), Status.Hit);


            var listForMarking = new List <Coordinate>
            {
                Coordinate.FromIndex(1, 0),
                Coordinate.FromIndex(1, 1),
                Coordinate.FromIndex(2, 1),
                Coordinate.FromIndex(3, 1),
                Coordinate.FromIndex(0, 1)
            };

            botLogic.MarkShipAsSunk(listForMarking);

            botLogic.GetNextCoordinate();
            shipDataGeneratorMock.Verify(x => x.GetRand0To9(), Times.Exactly(2));
        }