Ejemplo n.º 1
0
        public void ClickingOnDepotSendsOutTrain()
        {
            var world = new World(TileType.GetTileTypes(), new DateTime());

            var depot = world.CreateFromName("depot", new Int2(), 2);

            world.AddTile(depot);
            world.AddTile(world.CreateFromName("railStraight", new Int2(6, 1), 0));

            Assert.IsTrue(world.ClickTile(depot.BaseData));
            var expected = new[]
            {
                depot.With(data: new TileDepot(new[] { new Train(1, World.TrainSpeed, false, 0) }.ToImmutableList(), false))
            };

            Assert.AreEqual(expected, world.RailTiles);
        }
Ejemplo n.º 2
0
        public void TrainFlipsTurnFork()
        {
            var world = new World(TileType.GetTileTypes(), new DateTime());

            var depot = world.CreateFromName("depot", new Int2(), 2);

            world.AddTile(depot);
            var rail = world.CreateFromName("railSplitLeft", new Int2(5, 1), 1);

            world.AddTile(rail);

            world.ClickTile(depot.BaseData);

            world.MoveTrains(new DateTime() + TimeSpan.FromSeconds(3));

            var expected = new[]
            {
                rail.With(data: new TileRailFork(new[] { new Train(0, World.TrainSpeed, false, 0) }.ToImmutableList(), true))
            };

            Assert.AreEqual(expected, world.RailTiles);
        }
Ejemplo n.º 3
0
        public void TrainTurn(bool turnUp)
        {
            var world = new World(TileType.GetTileTypes(), new DateTime());

            var depot = world.CreateFromName("depot", new Int2(), 2);

            world.AddTile(depot);
            var rail = world.CreateFromName("railTurn", new Int2(5, turnUp ? -1 : 1), turnUp ? 0 : 1);

            world.AddTile(rail);

            world.ClickTile(depot.BaseData);

            world.MoveTrains(new DateTime() + TimeSpan.FromSeconds(3));

            var expected = new[]
            {
                rail.With(data: new TileRail(new[] { new Train(turnUp ? 1 : 0, World.TrainSpeed, turnUp, 0) }.ToImmutableList()))
            };

            Assert.AreEqual(expected, world.RailTiles);
        }