Exemplo n.º 1
0
        public void WhenMovementOutOfTheArenaPositionStaysTheSame(
            int initialPositionX,
            int initialPositionY,
            Heading heading,
            int finalPositionX,
            int finalPositionY
            )
        {
            // Arrange
            var otherRobots = new List <Robot>
            {
                new Robot(new Position(0, 1, Heading.E)),
                new Robot(new Position(1, 0, Heading.E)),
                new Robot(new Position(1, 2, Heading.E)),
                new Robot(new Position(2, 1, Heading.E)),
            };
            var dimensions      = new Dimensions(3, 3);
            var initialPosition = new Position(initialPositionX, initialPositionY, heading);
            var systemUnderTest = new RobotWars.Commands.MoveCommand();

            // Act
            var result = systemUnderTest.Execute(initialPosition, otherRobots, dimensions);

            // Assert
            result.Should().BeOfType <Position>();
            result.X.Should().Be(finalPositionX);
            result.Y.Should().Be(finalPositionY);
            result.Heading.Should().Be(heading);
        }
Exemplo n.º 2
0
        public void WhenValidMovementNewPositionChangesBasedOnHeading(
            int initialPositionX,
            int initialPositionY,
            Heading heading,
            int finalPositionX,
            int finalPositionY
            )
        {
            // Arrange
            var otherRobots     = new List <Robot>();
            var dimensions      = new Dimensions(3, 3);
            var initialPosition = new Position(initialPositionX, initialPositionY, heading);
            var systemUnderTest = new RobotWars.Commands.MoveCommand();

            // Act
            var result = systemUnderTest.Execute(initialPosition, otherRobots, dimensions);

            // Assert
            result.Should().BeOfType <Position>();
            result.X.Should().Be(finalPositionX);
            result.Y.Should().Be(finalPositionY);
            result.Heading.Should().Be(heading);
        }