当前位置: 首页>>代码示例>>C#>>正文


C# Robot.ExecuteCommands方法代码示例

本文整理汇总了C#中Robot.ExecuteCommands方法的典型用法代码示例。如果您正苦于以下问题:C# Robot.ExecuteCommands方法的具体用法?C# Robot.ExecuteCommands怎么用?C# Robot.ExecuteCommands使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Robot的用法示例。


在下文中一共展示了Robot.ExecuteCommands方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RunRobot_EmptyCommandSet_RobotPositionShouldNotChange

        public void RunRobot_EmptyCommandSet_RobotPositionShouldNotChange()
        {
            //arrange
            CommandFactory commandFactory = new CommandFactory();
            commandFactory.AddInput("0");
            commandFactory.AddInput("0 0");
            CommandSet commandSet = commandFactory.GetCommandSet();
            Robot robot = new Robot(commandSet, null);

            //act
            robot.ExecuteCommands();

            //assert
            Assert.AreEqual(commandSet.StartPosition.X, robot.Position.X);
            Assert.AreEqual(commandSet.StartPosition.Y, robot.Position.Y);
        }
开发者ID:shaneinsweden,项目名称:RobotCleaner,代码行数:16,代码来源:RobotTests.cs

示例2: RunRobot_EmptyCommandSetNullReporter_ZeroPlaceReportGenerated

        public void RunRobot_EmptyCommandSetNullReporter_ZeroPlaceReportGenerated()
        {
            //arrange
            CommandFactory commandFactory = new CommandFactory();
            commandFactory.AddInput("0");
            commandFactory.AddInput("0 0");
            CommandSet commandSet = commandFactory.GetCommandSet();
            Robot robot = new Robot(commandSet, null);

            //act
            robot.ExecuteCommands();
            string report = robot.PrintReport();

            //assert
            Assert.AreEqual("=> Cleaned: unknown", report);
        }
开发者ID:shaneinsweden,项目名称:RobotCleaner,代码行数:16,代码来源:RobotTests.cs

示例3: Main

        static void Main(string[] args)
        {
            //collect a set of inputs from standard in
            CommandFactory commandFactory = new CommandFactory();

            while (!commandFactory.InputsAreComplete)
            {
                Console.WriteLine(">");
                commandFactory.AddInput(Console.ReadLine());
            }
            Console.WriteLine("Input complete. Press any key to continue..");
            Console.ReadLine();

            //robot should execute cleaning commands
            SimpleReporter reporter = new SimpleReporter();
            Robot robbie = new Robot(commandFactory.GetCommandSet(), reporter, new Location(0,0), new Location(7,7));
            robbie.ExecuteCommands();

            //give output on the number of places cleaned
            Console.WriteLine(robbie.PrintReport());
        }
开发者ID:shaneinsweden,项目名称:RobotCleaner,代码行数:21,代码来源:Program.cs

示例4: RunRobot_BoxMoveCommandSet_NumberofLocationsIsCorrect

        public void RunRobot_BoxMoveCommandSet_NumberofLocationsIsCorrect()
        {
            //arrange
            CommandFactory commandFactory = new CommandFactory();
            commandFactory.AddInput("4");
            commandFactory.AddInput("0 0");
            commandFactory.AddInput("N 7");
            commandFactory.AddInput("E 7");
            commandFactory.AddInput("S 7");
            commandFactory.AddInput("W 7");
            CommandSet commandSet = commandFactory.GetCommandSet();
            IReport reporter = new SimpleReporter();
            Robot robot = new Robot(commandSet, reporter, new Location(0, 0), new Location(7, 7));

            //act
            robot.ExecuteCommands();
            string report = robot.PrintReport();

            //assert
            Assert.AreEqual("=> Cleaned: 28", report);
        }
开发者ID:shaneinsweden,项目名称:RobotCleaner,代码行数:21,代码来源:RobotTests.cs

示例5: RunRobot_SimplestCommandSetOneMove_RobotReports1LocationCleaned

        public void RunRobot_SimplestCommandSetOneMove_RobotReports1LocationCleaned()
        {
            //arrange
            CommandFactory commandFactory = new CommandFactory();
            commandFactory.AddInput("1");
            commandFactory.AddInput("10 10");
            commandFactory.AddInput("N 1");
            CommandSet commandSet = commandFactory.GetCommandSet();
            IReport reporter = new SimpleReporter();
            Robot robot = new Robot(commandSet, reporter, new Location(-100000, -100000), new Location(100000, 100000));

            robot.ExecuteCommands();

            //act
            string report = robot.PrintReport();

            //assert
            Assert.AreEqual("=> Cleaned: 1", report);
        }
开发者ID:shaneinsweden,项目名称:RobotCleaner,代码行数:19,代码来源:RobotTests.cs

示例6: RunRobot_SimpleCommandSet_RobotPositionYShouldChangeBy1

        public void RunRobot_SimpleCommandSet_RobotPositionYShouldChangeBy1()
        {
            //arrange
            CommandFactory commandFactory = new CommandFactory();
            commandFactory.AddInput("1");
            commandFactory.AddInput("0 0");
            commandFactory.AddInput("N 1");
            CommandSet commandSet = commandFactory.GetCommandSet();
            Robot robot = new Robot(commandSet, null);

            //act
            robot.ExecuteCommands();

            //assert
            Assert.AreEqual(commandSet.StartPosition.X, robot.Position.X);
            Assert.AreEqual(commandSet.StartPosition.Y + 1, robot.Position.Y);
        }
开发者ID:shaneinsweden,项目名称:RobotCleaner,代码行数:17,代码来源:RobotTests.cs

示例7: RunRobot_IllegalOutOfBoundsCommandSet_RobotPositionShouldRemainWithinBounds

        public void RunRobot_IllegalOutOfBoundsCommandSet_RobotPositionShouldRemainWithinBounds()
        {
            //arrange
            CommandFactory commandFactory = new CommandFactory();
            commandFactory.AddInput("1");
            commandFactory.AddInput("100000 100000");
            commandFactory.AddInput("N 1");
            CommandSet commandSet = commandFactory.GetCommandSet();
            Robot robot = new Robot(commandSet, null, null, new Location(100000, 100000) );

            //act
            robot.ExecuteCommands();

            //assert
            Assert.AreEqual(commandSet.StartPosition.X, robot.Position.X);
            Assert.AreEqual(commandSet.StartPosition.Y, robot.Position.Y);
        }
开发者ID:shaneinsweden,项目名称:RobotCleaner,代码行数:17,代码来源:RobotTests.cs


注:本文中的Robot.ExecuteCommands方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。