Exemplo n.º 1
0
        public void Drone_is_valid_constructed_from_map()
        {
            // Given
            var randomizerStub = new Mock<IRandomizer>();
            randomizerStub.Setup(r => r.Next(Map.MinValue, Map.MaxValue)).Returns(1);
            var map = new Map(10, randomizerStub.Object);

            // When
            var drone = new Drone(map, 0, 2);

            // Then
            drone.Value.Should().Be(1);
        }
Exemplo n.º 2
0
        public void Drones_are_valid_constructed_from_drone()
        {
            // Given
            var randomizerStub = new Mock<IRandomizer>();
            randomizerStub.Setup(r => r.Next(Map.MinValue, Map.MaxValue)).Returns(1);
            var map = new Map(10, randomizerStub.Object);
            var drone = new Drone(map, 0, 2);

            // When
            var droneSpawns = drone.CreateSpawns(map).ToList();

            // Then
            droneSpawns.All(d => d.Value == 2).Should().BeTrue();
            droneSpawns.Count().Should().Be(10);
        }
Exemplo n.º 3
0
 private Drone(Map map, Drone parent, int x)
 {
     _y = parent._y + 1;
     _x = x;
     Value = parent.Value + map[_x, _y];
 }