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


C# Rover.Go方法代码示例

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


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

示例1: MoveRoverBackwardFacingSouth

        public void MoveRoverBackwardFacingSouth()
        {
            var rover = new Rover(new Position(1, 1), Direction.S);

            rover.Go(@"b");

            Assert.Equal(new Position(1, 2), rover.RoverState.Position);
        }
开发者ID:vphilomin,项目名称:MarsRover,代码行数:8,代码来源:MarsRoverFixture.cs

示例2: GoingOffTheGridToTheRightWrapsToTheLeft

        public void GoingOffTheGridToTheRightWrapsToTheLeft()
        {
            var rover = new Rover(new Position(99, 1), Direction.E, new Grid(100, 100));

            rover.Go(@"f");

            Assert.Equal(new Position(0, 1), rover.RoverState.Position);
        }
开发者ID:vphilomin,项目名称:MarsRover,代码行数:8,代码来源:MarsRoverFixture.cs

示例3: GoingOffTheGridToTheTopWrapsToTheBottom

        public void GoingOffTheGridToTheTopWrapsToTheBottom()
        {
            var rover = new Rover(new Position(1, 99), Direction.N, new Grid(100, 100));

            rover.Go(@"ff");

            Assert.Equal(new Position(1, 1), rover.RoverState.Position);
        }
开发者ID:vphilomin,项目名称:MarsRover,代码行数:8,代码来源:MarsRoverFixture.cs

示例4: MoveRoverForwardFacingEast

        public void MoveRoverForwardFacingEast()
        {
            var rover = new Rover(new Position(1, 1), Direction.E);

            rover.Go(@"f");

            Assert.Equal(new Position(2, 1), rover.RoverState.Position);
        }
开发者ID:vphilomin,项目名称:MarsRover,代码行数:8,代码来源:MarsRoverFixture.cs

示例5: TurnRoverRightFacingWest

        public void TurnRoverRightFacingWest()
        {
            var rover = new Rover(new Position(1, 1), Direction.W);

            rover.Go(@"r");

            Assert.Equal(Direction.N, rover.RoverState.Direction);
        }
开发者ID:vphilomin,项目名称:MarsRover,代码行数:8,代码来源:MarsRoverFixture.cs

示例6: UnknownCommandThrowsException

        public void UnknownCommandThrowsException()
        {
            var rover = new Rover(new Position(0, 0), Direction.N);

            Assert.Throws<NotSupportedException>(() => rover.Go(@"fc"));
        }
开发者ID:vphilomin,项目名称:MarsRover,代码行数:6,代码来源:MarsRoverFixture.cs

示例7: TurnRoverLeftFacingSouth

        public void TurnRoverLeftFacingSouth()
        {
            var rover = new Rover(new Position(1, 1), Direction.S);

            rover.Go(@"l");

            Assert.Equal(Direction.E, rover.RoverState.Direction);
        }
开发者ID:vphilomin,项目名称:MarsRover,代码行数:8,代码来源:MarsRoverFixture.cs

示例8: RoverStopsJustBeforeObstacleWhileUsingForwardCommands

        public void RoverStopsJustBeforeObstacleWhileUsingForwardCommands()
        {
            var grid = new Grid(5, 5);
            grid.AddObstacle(1, 1);
            var rover = new Rover(new Position(0, 0), Direction.N, grid);

            rover.Go(@"frff");

            Assert.Equal(new Position(0, 1), rover.RoverState.Position);
        }
开发者ID:vphilomin,项目名称:MarsRover,代码行数:10,代码来源:MarsRoverFixture.cs

示例9: MovingRoverForwardAndBackWardTwiceBringsBackRoverToStartingPostion

        public void MovingRoverForwardAndBackWardTwiceBringsBackRoverToStartingPostion()
        {
            var rover = new Rover(new Position(0, 0), Direction.N);

            rover.Go(@"ffbb");

            Assert.Equal(new Position(0, 0), rover.RoverState.Position);
        }
开发者ID:vphilomin,项目名称:MarsRover,代码行数:8,代码来源:MarsRoverFixture.cs

示例10: MoveRoverWithSeriesOfCommands

        public void MoveRoverWithSeriesOfCommands()
        {
            var rover = new Rover(new Position(0, 0), Direction.N);

            rover.Go(@"ffrff");

            Assert.Equal(new Position(2, 2), rover.RoverState.Position);
            Assert.Equal(Direction.E, rover.RoverState.Direction);
        }
开发者ID:vphilomin,项目名称:MarsRover,代码行数:9,代码来源:MarsRoverFixture.cs

示例11: MoveRoverForwardFacingNorth

        public void MoveRoverForwardFacingNorth()
        {
            var rover = new Rover(new Position(0, 0), Direction.N);

            rover.Go(@"f");

            Assert.Equal(new Position(0, 1), rover.RoverState.Position);
        }
开发者ID:vphilomin,项目名称:MarsRover,代码行数:8,代码来源:MarsRoverFixture.cs


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