コード例 #1
0
        public void TransmitCommandSequenceTest()
        {
            //arrange
            var mocks = new Mocks();
            var robots = new List<Robot> { mocks.GetRobot() };
            var commandStation = new CommandStation(robots);

            //act
            commandStation.TransmitCommandSequence(0, mocks.GetCommandSequence());

            //assert
            var robot = commandStation.Robots[0];
            Assert.AreEqual(3, robot.X);
            Assert.AreEqual(3, robot.Y);
            Assert.AreEqual(Orientation.north, robot.Orientation);
            Assert.AreEqual(true, robot.IsLost);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: DylanReile/martian-robots
        static void Main(string[] args)
        {
            var input = Input.GetUserInput();
            List<Robot> robots;
            List<List<Command>> commandSequences;
            Input.GetRobotsAndCommandSequences(input, out robots, out commandSequences);

            var commandStation = new CommandStation(robots);
            for(int i=0; i<commandStation.Robots.Count(); i++)
                commandStation.TransmitCommandSequence(i, commandSequences[i]);

            var robotReport = Output.GetRobotReport(robots);
            Console.Write(robotReport);

            Console.Write("Press any key to exit...");
            Console.ReadKey();
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: rigids/martian-robots
        static void Main(string[] args)
        {
            var                    input = Input.GetUserInput();
            List <Robot>           robots;
            List <List <Command> > commandSequences;

            Input.GetRobotsAndCommandSequences(input, out robots, out commandSequences);

            var commandStation = new CommandStation(robots);

            for (int i = 0; i < commandStation.Robots.Count(); i++)
            {
                commandStation.TransmitCommandSequence(i, commandSequences[i]);
            }

            var robotReport = Output.GetRobotReport(robots);

            Console.Write(robotReport);

            Console.Write("Press any key to exit...");
            Console.ReadKey();
        }