예제 #1
0
        public void ExampleTest()
        {
            // Requirement 1:
            //  Given the command "FFRFF" would put the rover at 2,2 facing East.

            MoveCommand moveCommand = new MoveCommand()
            {
                Data = "FFRFF"
            };
            SimpleRover rover = new SimpleRover();

            rover.ExecuteCommand(moveCommand);
            SimpleTelemetry st = rover.GetTelemetry();

            Assert.AreEqual(2, st.X);
            Assert.AreEqual(2, st.Y);
            Assert.AreEqual(SimpleOrientation.East, st.Orientation);
        }
예제 #2
0
        public void EventTest()
        {
            object obstacleSender = null;

            MoveCommand moveCommand = new MoveCommand()
            {
                Data = "FxFFR"
            };
            SimpleRover rover = new SimpleRover();

            rover.ObstacleDetected += delegate(object sender, EventArgs e)
            {
                obstacleSender = sender;
            };

            rover.ExecuteCommand(moveCommand);
            SimpleTelemetry st = rover.GetTelemetry();

            Assert.AreEqual(1, st.Y);
            Assert.AreEqual(0, st.X);
            Assert.AreEqual(SimpleOrientation.North, st.Orientation);
            Assert.AreEqual(obstacleSender, rover);
        }