本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例6: UnknownCommandThrowsException
public void UnknownCommandThrowsException()
{
var rover = new Rover(new Position(0, 0), Direction.N);
Assert.Throws<NotSupportedException>(() => rover.Go(@"fc"));
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}