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 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)); }
/// <summary> /// Drive our mower will throw in mower not initialised /// </summary> /// <param name="command"></param> /// <returns></returns> public string RunCommand(string command) { if (_currentMower == null) { throw new NullReferenceException("Please run InitMower() before running command"); } _currentMower.RunCommand(command); return(_currentMower.ToString()); }