public void Execute_SetsAllCells_ToVisited()
        {
            var map = new Map(2, 3);
            var parameters = new DungeonParameters();
            var command = new CorridorBuilderCommand(new DirectionPicker(50));

            command.Execute(map, parameters);

            Assert.That(map, Has.All.With.Property(nameof(MapCell.IsVisited)).True);
        }
        public void Execute_ShouldThrow_IfMapContainsVisitedCell(int x, int y)
        {
            var map = new Map(2, 3);
            var parameters = new DungeonParameters();
            var command = new CorridorBuilderCommand(new DirectionPicker(50));

            map.Visit(map[x, y]);

            Assert.That(() => command.Execute(map, parameters),
                Throws.InvalidOperationException);
        }
        public void Execute_ShouldThrow_IfTwistFactorIsInvalid(int factor)
        {
            var map = new Map(2, 3);
            var parameters = new DungeonParameters
            {
                TwistFactor = factor
            };
            var command = new CorridorBuilderCommand(new DirectionPicker(50));

            Assert.That(() => command.Execute(map, parameters),
                Throws.InstanceOf<ArgumentOutOfRangeException>());
        }
 private void BuildCorridors()
 {
     var corridorBuilderCommand = new CorridorBuilderCommand(
             new DirectionPicker(_parameters.TwistFactor));
     corridorBuilderCommand.Execute(_map, _parameters);
 }
        public void SetUp()
        {
            _map = new Map(15, 20);
            _parameters = new DungeonParameters
            {
                CellSparseFactor = 50,
                DeadEndSparseFactor = 60,
                TwistFactor = 45,
                Height = 20,
                Width = 15,
                RoomParameters =
                {
                    Count = 2,
                    MaxHeight = 5,
                    MaxWidth = 5,
                    MinHeight = 5,
                    MinWidth = 4
                }
            };
            _command = new PlaceRoomsCommand();

            var corridorBuilderCommand = new CorridorBuilderCommand(
                new DirectionPicker(_parameters.TwistFactor));
            corridorBuilderCommand.Execute(_map, _parameters);
        }