コード例 #1
0
        public IGrid Build()
        {
            for (var i = 0; i < 100; i++)
            {
                _grid.Build(_config.Value.Grid.ColumnCount.Value, _config.Value.Grid.RowCount.Value);

                if (TrySetShipsOnGrid())
                {
                    return(_grid);
                }
            }

            throw new ApplicationException("Can't find any place for new ship.");
        }
コード例 #2
0
        public void Build_RightData_SizeAndShipsAreInitialized()
        {
            _sut.Build(10, 5);

            _sut.Size.ColumnCount.Should().Be(10);
            _sut.Size.RowCount.Should().Be(5);
            _sut.Ships.Should().NotBeNull();
            _sut.Ships.Should().BeEmpty();
        }