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


C# Game.WithRobots方法代码示例

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


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

示例1: PlaceRobot

        public void PlaceRobot()
        {
            var game = new Game(5, 5);
            game.Take("1 2 N");

            game.WithRobots(robots =>
                {
                    Assert.Equal(1, robots[0].Position.X);
                    Assert.Equal(2, robots[0].Position.Y);
                    Assert.Equal('N', robots[0].Orientation);
                });
        }
开发者ID:naighes,项目名称:PersonalRepository,代码行数:12,代码来源:GameTests.cs

示例2: AcceptanceTest

        public void AcceptanceTest()
        {
            var game = new Game(5, 5);
            game.Take("1 2 N");
            game.Take("LMLMLMLMM");
            game.Take("3 3 E");
            game.Take("MMRMMRMRRM");

            game.WithRobots(robots =>
                {
                    Assert.Equal("1 3 N", robots[0].ToString());
                    Assert.Equal("5 1 E", robots[1].ToString());
                });
        }
开发者ID:naighes,项目名称:PersonalRepository,代码行数:14,代码来源:GameTests.cs

示例3: MoveRobot

        public void MoveRobot()
        {
            new[]
                {
                    new Tuple<String, Point>("M", new Point(1, 3)),
                    new Tuple<String, Point>("MMM", new Point(1, 5)),
                    new Tuple<String, Point>("RMM", new Point(3, 2)),
                    new Tuple<String, Point>("RMLMLMLM", new Point(1, 2))
                }.ToList().ForEach(useCase =>
                    {
                        var game = new Game(5, 5);

                        game.Take("1 2 N");
                        game.Take(useCase.Item1);

                        game.WithRobots(robots => Assert.Equal(useCase.Item2, robots[0].Position));
                    });
        }
开发者ID:naighes,项目名称:PersonalRepository,代码行数:18,代码来源:GameTests.cs

示例4: StateIsPreserved

        public void StateIsPreserved()
        {
            var game = new Game(5, 5);
            game.Take("0 0 N");
            game.Take("M");
            game.Take("1 1 E");
            game.Take("M");

            game.WithRobots(robots =>
                {
                    Assert.Equal("0 1 N", robots[0].ToString());
                    Assert.Equal("2 1 E", robots[1].ToString());
                    robots[0].Move();
                });

            game.WithRobots(robots => Assert.Equal("0 1 N", robots[0].ToString()));
        }
开发者ID:naighes,项目名称:PersonalRepository,代码行数:17,代码来源:GameTests.cs

示例5: RotateRobot

        public void RotateRobot(String input, Char expectedDirection)
        {
            var game = new Game(5, 5);

            game.Take("1 2 N");
            game.Take(input);

            game.WithRobots(robots => Assert.Equal(expectedDirection, robots[0].Orientation));
        }
开发者ID:naighes,项目名称:PersonalRepository,代码行数:9,代码来源:GameTests.cs


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