Example #1
0
        public void SatelliteExecutesCommand()
        {
            var input = "this is my input";

            var worldSize = new Point(9266, 90210);

            mockInstructionParser.Setup(p => p.ParseWorldMapSize(input)).Returns(worldSize);

            var roversAndInstructions = new Dictionary <Location, IEnumerable <char> >();

            roversAndInstructions[new Location(42, 600, ORIENTATION.EAST)] = "commands";

            mockInstructionParser.Setup(p => p.ParseRovers(input)).Returns(roversAndInstructions);

            var mockRover = new Mock <IRover>();

            mockRoverFactory.Setup(f => f.Construct()).Returns(mockRover.Object);

            mockRover.SetupAllProperties();
            mockRover.Setup(r => r.ExecuteInstruction(It.IsAny <char>())).Returns((char i) => GetNewLocation(mockRover.Object.CurrentLocation));

            var results = satellite.ExecuteCommands(input);

            Assert.That(results, Is.EqualTo(@"50 608 E"));
        }