Exemplo n.º 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"));
        }
Exemplo n.º 2
0
        public void When_Coordinates_Are_Five_By_Five_Then_Lawn_Is_Created_Five_By_Five()
        {
            int expectedX = 5;
            int expectedY = 5;

            Lawn actualLawn = Lawn.Create("5 5");

            Assert.IsNotNull(actualLawn);
            Assert.IsNotNull(actualLawn.Border);
            Assert.That(actualLawn.Border.X, Is.EqualTo(expectedX));
            Assert.That(actualLawn.Border.Y, Is.EqualTo(expectedY));
        }