예제 #1
0
        public async Task Init()
        {
            // mock settings with an in-memory configuration
            var inMemorySettings = new Dictionary <string, string> {
                { "outputRelativePath", "foo" },
                { "grid:width", "1280" },
                { "grid:height", "720" },
                { "tiles:size", "720" },
                { "generator", "TeenyZonesGenerator" },
                { "serialiser", "JsonSerialiser" }
            };

            IConfiguration configuration = new ConfigurationBuilder()
                                           .AddInMemoryCollection(inMemorySettings)
                                           .Build();

            roomService = new RoomService(new Settings(configuration));

            var room1 = await RoomBuilder.Create().WithHeight(10).WithWidth(10).WithStartingPosition(new Position(0, 0))
                        .WithInsideTilesOfType(TileType.Floor).WithOutsideWalls().BuildAsync();

            var room2 = await RoomBuilder.Create().WithHeight(10).WithWidth(10).WithStartingPosition(new Position(5, 5))
                        .WithInsideTilesOfType(TileType.Floor).WithOutsideWalls().BuildAsync();

            var room3 = await RoomBuilder.Create().WithHeight(5).WithWidth(5).WithStartingPosition(new Position(25, 25))
                        .WithInsideTilesOfType(TileType.Floor).WithOutsideWalls().BuildAsync();

            rooms = new List <Room> {
                room1, room2, room3
            };
        }