public void ShouldMoveLeftOffCommand()
        {
            var mower = new Mower(0, 0, 0);
            mower.RunCommand("LL");

            Assert.That(mower.Direction, Is.EqualTo(2));
        }
        public void ShouldMoveForwardOffCommand()
        {
            var mower = new Mower(0, 0, 0);
            mower.RunCommand("MM");

            Assert.That(mower.Position.Y, Is.EqualTo(2));
        }
        public void ShouldMoveNorth()
        {
            var mower = new Mower(0, 0, 0);
            mower.MoveForward();

            Assert.That(mower.Position.Y, Is.EqualTo(1));
            Assert.That(mower.Position.X, Is.EqualTo(0));
        }
        public void ShouldMoveRight()
        {
            var mower = new Mower(0, 0, 0);

            mower.MoveRight();
            Assert.That(mower.Direction, Is.EqualTo(1));
            mower.MoveRight();
            Assert.That(mower.Direction, Is.EqualTo(2));
            mower.MoveRight();
            Assert.That(mower.Direction, Is.EqualTo(3));
            mower.MoveRight();
            Assert.That(mower.Direction, Is.EqualTo(0));
        }
        public void ShouldMoveRightOffCommand()
        {
            var mower = new Mower(0, 0, 0);
            mower.RunCommand("RRR");

            Assert.That(mower.Direction, Is.EqualTo(3));
        }
        public void ShouldRunFullCommand1()
        {
            var mower = new Mower(3, 3, 1);
            mower.RunCommand("MMRMMRMRRM");

            Assert.That(mower.Position.X, Is.EqualTo(5));
            Assert.That(mower.Position.Y, Is.EqualTo(1));
            Assert.That(mower.Direction, Is.EqualTo(1));
        }
        public void ShouldRunFullCommand()
        {
            var mower = new Mower(1, 2, 0);
            mower.RunCommand("LMLMLMLMM");

            Assert.That(mower.Position.X, Is.EqualTo(1));
            Assert.That(mower.Position.Y, Is.EqualTo(3));
            Assert.That(mower.Direction, Is.EqualTo(0));
        }
        public void ShouldMoveWest()
        {
            var mower = new Mower(1, 1, 0);
            mower.MoveRight();
            mower.MoveRight();
            mower.MoveRight();
            mower.MoveForward();

            Assert.That(mower.Position.Y, Is.EqualTo(1));
            Assert.That(mower.Position.X, Is.EqualTo(0));
        }
Example #9
0
 /// <summary>
 /// Set mower direction and position
 /// </summary>
 /// <param name="input"></param>
 public void InitMower(string input)
 {
     _currentMower = MowerFactory.Init(input);
 }