Exemple #1
0
        public void Input_And_Output()
        {
            string input = @"5 5
1 2 N
LMLMLMLMM
3 3 E
MMRMMRMRRM";

            string[] inputLines = input.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);

            IList <Mower> mowers = new List <Mower>();

            Lawn lawn = Lawn.Create(inputLines[0]);

            RemoteControl remoteControl = new RemoteControl();

            for (int i = 1; i < inputLines.Length - 1; i += 2)
            {
                Mower mower = new Mower(lawn.Border);
                mower.Deploy(inputLines[i]);

                remoteControl.ConnectMower(mower);
                remoteControl.Send(inputLines[i + 1]);

                mowers.Add(mower);
            }

            Assert.That(mowers.Count, Is.EqualTo(2));
            Assert.That(mowers[0].Status, Is.EqualTo("1 3 N"));
            Assert.That(mowers[1].Status, Is.EqualTo("5 1 E"));
        }
Exemple #2
0
        public void When_Mower_Position_Is_Valid_Then_Mower_Is_Deployed()
        {
            Border border = new Border(5, 5);
            Mower  mower  = new Mower(border);

            mower.Deploy("1 2 N");

            Assert.IsTrue(mower.IsDeployed);
        }