コード例 #1
0
ファイル: MoveTest.cs プロジェクト: iworm/marsexplorer
        public void GoForwardButNowIsHeadingWestEdgeShouldThrowException()
        {
            IPosition position = new Position(0, 0);
            IHeading heading = new HeadingWest();
            IList<char> MovingInstruction = new List<char>();
            MovingInstruction.Add('M');

            var robot = new Robot(0, position, heading, MovingInstruction, _targetPlateau);
            robot.Move();
        }
コード例 #2
0
        public void CorrectLandingPositionAndHeading()
        {
            IPosition position = new Position(1, 2);
            IHeading heading = new HeadingWest();
            IList<char> MovingInstruction = new List<char>();
            var plateau = new Plateau(5, 5);

            MovingInstruction.Add('L');

            var robot = new Robot(0, position, heading, MovingInstruction, plateau);
            Assert.AreEqual(1, robot.CurrentPosition.X);
            Assert.AreEqual(2, robot.CurrentPosition.Y);
            Assert.AreEqual(typeof (HeadingWest), robot.Heading.GetType());
        }
コード例 #3
0
ファイル: MoveTest.cs プロジェクト: iworm/marsexplorer
        public void TurnRight()
        {
            IPosition position = new Position(1, 2);
            IHeading heading = new HeadingWest();
            IList<char> MovingInstruction = new List<char>();
            MovingInstruction.Add('R');

            var robot = new Robot(0, position, heading, MovingInstruction, _targetPlateau);
            robot.Move();

            Assert.AreEqual(1, robot.CurrentPosition.X);
            Assert.AreEqual(2, robot.CurrentPosition.Y);
            Assert.AreEqual(typeof (HeadingNorth), robot.Heading.GetType());
        }
コード例 #4
0
ファイル: MoveTest.cs プロジェクト: iworm/marsexplorer
        public void InvalidMoveInstructionShouldThrowException()
        {
            IPosition position = new Position(1, 2);
            IHeading heading = new HeadingWest();
            IList<char> MovingInstruction = new List<char>();
            MovingInstruction.Add('T');

            var robot = new Robot(0, position, heading, MovingInstruction, _targetPlateau);
            robot.Move();
        }