本文整理汇总了C#中Rover.MoveForward方法的典型用法代码示例。如果您正苦于以下问题:C# Rover.MoveForward方法的具体用法?C# Rover.MoveForward怎么用?C# Rover.MoveForward使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rover
的用法示例。
在下文中一共展示了Rover.MoveForward方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestMoveForward
public void TestMoveForward()
{
var rover = new Rover(new Point { X = 0, Y = 0 }, 'E', stateFactory, planet);
rover.MoveForward();
Assert.That(rover.GetCurrentPosition().ToString(), Is.EqualTo("1,0"));
}
示例2: TestEncounterObstacleOnOtherSideOfAxisAndDoesNotMoveForward
public void TestEncounterObstacleOnOtherSideOfAxisAndDoesNotMoveForward()
{
var planetWithObstruction = new Planet(50, new Point[] { new Point { X = -25, Y = 0 } });
var rover = new Rover(new Point { X = 25, Y = 0 }, 'E', stateFactory, planetWithObstruction);
rover.MoveForward();
Assert.That(rover.GetCurrentPosition().ToString(), Is.EqualTo("25,0"));
}
示例3: TestEnountersObstructionAndDoesNotMoveForward
public void TestEnountersObstructionAndDoesNotMoveForward()
{
var planetWithObstruction = new Planet(50, new Point[] { new Point { X = 1, Y = 0 } });
var rover = new Rover(new Point { X = 0, Y = 0 }, 'E', stateFactory, planetWithObstruction);
rover.MoveForward();
Assert.That(rover.GetCurrentPosition().ToString(), Is.EqualTo("0,0"));
}
示例4: TestRoverEncountersObstacleMovingNegatively
public void TestRoverEncountersObstacleMovingNegatively()
{
var obstructionPoint = new Point { X = 2, Y = 2 };
var planetWithObstacles = new Planet(50, new Point[] { obstructionPoint });
var rover = new Rover(new Point { X = 3, Y = 2 }, 'W', stateFactory, planetWithObstacles);
rover.MoveForward();
Assert.That(rover.IsObstructed, Is.EqualTo(true));
Assert.That(rover.Obstruction.ToString(), Is.EqualTo(obstructionPoint.ToString()));
Assert.That(rover.GetCurrentPosition().ToString(), Is.EqualTo("3,2"));
}
示例5: TestRoverWrapsAroundPlanetForward
public void TestRoverWrapsAroundPlanetForward()
{
var rover = new Rover(new Point { X = 0, Y = 50 }, 'N', stateFactory, planet);
rover.MoveForward();
Assert.That(rover.GetCurrentPosition().ToString(), Is.EqualTo("0,-50"));
}
示例6: TestMoveRoverForwardWest
public void TestMoveRoverForwardWest()
{
var rover = new Rover(pointAtZeroZero, 'W', stateFactory, planet);
rover.MoveForward();
Assert.That(rover.GetCurrentPosition().ToString(), Is.EqualTo("-1,0"));
}
示例7: TestTurnRoverRightFromNorth
public void TestTurnRoverRightFromNorth()
{
var rover = new Rover(pointAtZeroZero, 'N', stateFactory, planet);
rover.TurnRight();
rover.TurnRight();
rover.TurnRight();
rover.TurnRight();
rover.MoveForward();
Assert.That(rover.GetCurrentPosition().ToString(), Is.EqualTo("0,1"));
}
示例8: TestRoverWrapsAroundYAxisMovingForwardSouth
public void TestRoverWrapsAroundYAxisMovingForwardSouth()
{
var rover = new Rover(new Point { X = 0, Y = -25 }, 'S', stateFactory, planet);
rover.MoveForward();
Assert.That(rover.GetCurrentPosition().ToString(), Is.EqualTo("0,25"));
}
示例9: TestRoverWrapsAroundXAxisMovingForwardWest
public void TestRoverWrapsAroundXAxisMovingForwardWest()
{
var rover = new Rover(new Point { X = -25, Y = 0 }, 'W', stateFactory, planet);
rover.MoveForward();
Assert.That(rover.GetCurrentPosition().ToString(), Is.EqualTo("25,0"));
}
示例10: TestMoveRoverForwardSouth
public void TestMoveRoverForwardSouth()
{
var rover = new Rover(pointAtZeroZero, 'S', planet);
rover.MoveForward();
Assert.That(rover.GetCurrentPosition().ToString(), Is.EqualTo("0,-1"));
}