Beispiel #1
0
        public void Given_Initial_Location_Of_02E_When_Instructions_Are_MLMRMMMRMMRR_Then_Final_Location_And_Penalty_Count_Is_41N0()
        {
            Location initialLocation = new Location(0, 2);
            Heading  initialHeading  = new Heading("E");

            Location expectedLocation  = new Location(4, 1);
            Heading  expectedHeading   = new Heading("N");
            int      expectedPenalties = 0;

            string movementInstructions = "MLMRMMMRMMRR";

            BattleArena battleArena = new BattleArena();
            Robot       robot       = new Robot();
            Navigator   navigator   = new Navigator(battleArena, robot);

            battleArena.PlaceRobot(robot, initialLocation, initialHeading);

            Trace.WriteLine(robot.CurrentStatus);

            foreach (char instruction in movementInstructions)
            {
                navigator.Navigate(instruction);

                Trace.WriteLine(robot.CurrentStatus);
            }

            Assert.That(robot.Location.X, Is.EqualTo(expectedLocation.X));
            Assert.That(robot.Location.Y, Is.EqualTo(expectedLocation.Y));
            Assert.That(robot.Heading.Value, Is.EqualTo(expectedHeading.Value));
            Assert.That(robot.Penalties, Is.EqualTo(expectedPenalties));
        }
Beispiel #2
0
        public void When_Battle_Starts_Robot_Has_Initial_Location()
        {
            Location expectedLocation = new Location(0, 0);
            Heading  expectedHeading  = new Heading("N");

            BattleArena battleArena = new BattleArena();
            Robot       robot       = new Robot();

            battleArena.PlaceRobot(robot, expectedLocation, expectedHeading);

            Assert.That(robot.Location, Is.EqualTo(expectedLocation));
            Assert.That(robot.Heading, Is.EqualTo(expectedHeading));
        }