public void GenerateBoardGame_ShouldReturnOnlyNotCrossedShips()
        {
            var _shipGeneratorMock = new Mock <IShipGenerator>();

            _shipGeneratorMock.SetupSequence(sg => sg.GenerateShipFields(_firstShip.Count))
            .Returns(_firstShip)
            .Returns(_secondShipCrossedWithFirstShip)
            .Returns(_secondShip);
            var validator = SetupValidator();
            var sut       = new ShipsOnBoardGenerator(_shipGeneratorMock.Object, validator);

            var result = sut.PlaceShipsOnBoard(_boardSize, _shipsSizes);

            Assert.That(result, Is.Unique);
        }
        public void GenerateBoardGame_ShouldReturnValidShipFieldsCount()
        {
            var _shipGeneratorMock = new Mock <IShipGenerator>();

            _shipGeneratorMock.SetupSequence(sg => sg.GenerateShipFields(_firstShip.Count))
            .Returns(_firstShip)
            .Returns(_secondShip);

            var validator = SetupValidator();
            var sut       = new ShipsOnBoardGenerator(_shipGeneratorMock.Object, validator);

            var result = sut.PlaceShipsOnBoard(_boardSize, _shipsSizes);

            Assert.That(result, Has.Exactly(_shipsSizes.Sum()).Items);
        }
        public void GenerateBoardGame_ShouldPlaceOnlyShipsInBoardBounces()
        {
            var _shipGeneratorMock = new Mock <IShipGenerator>();

            _shipGeneratorMock.SetupSequence(sg => sg.GenerateShipFields(_firstShip.Count))
            .Returns(_firstShipOutOfBounds)
            .Returns(_firstShip);
            var validatorMock = new Mock <IInputValidator>();

            validatorMock.Setup(v => v.IsInputValid(_firstShipOutOfBounds.First())).Returns(false);
            validatorMock.Setup(v => v.IsInputValid(_firstShip.First())).Returns(true);

            var sut = new ShipsOnBoardGenerator(_shipGeneratorMock.Object, validatorMock.Object);

            var result = sut.PlaceShipsOnBoard(_boardSize, new List <int> {
                _firstShip.Count
            });

            Assert.That(_firstShipOutOfBounds, Is.Not.SubsetOf(result));
            Assert.That(_firstShip, Is.SubsetOf(result));
        }