本文整理汇总了C#中Rover.GetCurrentPosition方法的典型用法代码示例。如果您正苦于以下问题:C# Rover.GetCurrentPosition方法的具体用法?C# Rover.GetCurrentPosition怎么用?C# Rover.GetCurrentPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rover
的用法示例。
在下文中一共展示了Rover.GetCurrentPosition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: TestRoverWrapsAroundPlanetBackward
public void TestRoverWrapsAroundPlanetBackward()
{
var rover = new Rover(new Point { X = -50, Y = 0 }, 'E', stateFactory, planet);
rover.MoveBackward();
Assert.That(rover.GetCurrentPosition().ToString(), Is.EqualTo("50,0"));
}
示例5: 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"));
}
示例6: 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"));
}
示例7: TestMoveRoverForwardSouth
public void TestMoveRoverForwardSouth()
{
var rover = new Rover(pointAtZeroZero, 'S', stateFactory, planet);
rover.MoveForward();
Assert.That(rover.GetCurrentPosition().ToString(), Is.EqualTo("0,-1"));
}
示例8: TestMoveRoverMoveBackwardWest
public void TestMoveRoverMoveBackwardWest()
{
var rover = new Rover(pointAtZeroZero, 'W', stateFactory, planet);
rover.MoveBackward();
Assert.That(rover.GetCurrentPosition().ToString(), Is.EqualTo("1,0"));
}
示例9: 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"));
}
示例10: 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"));
}
示例11: 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"));
}
示例12: TestMoveRoverMoveBackwardNorth
public void TestMoveRoverMoveBackwardNorth()
{
var rover = new Rover(pointAtZeroZero, 'N', planet);
rover.MoveBackward();
Assert.That(rover.GetCurrentPosition().ToString(), Is.EqualTo("0,-1"));
}
示例13: TestMoveRoverForwardWest
public void TestMoveRoverForwardWest()
{
var rover = new Rover(pointAtZeroZero, 'W', planet);
rover.MoveForward();
Assert.That(rover.GetCurrentPosition().ToString(), Is.EqualTo("-1,0"));
}
示例14: TestRoverWrapsAroundYAxisMovingBackwardNorth
public void TestRoverWrapsAroundYAxisMovingBackwardNorth()
{
var rover = new Rover(new Point { X = 0, Y = -25 }, 'N', planet);
rover.MoveBackward();
Assert.That(rover.GetCurrentPosition().ToString(), Is.EqualTo("0,25"));
}
示例15: TestRoverWrapsAroundXAxisMovingBackwardEast
public void TestRoverWrapsAroundXAxisMovingBackwardEast()
{
var rover = new Rover(new Point { X = -25, Y = 0 }, 'E', planet);
rover.MoveBackward();
Assert.That(rover.GetCurrentPosition().ToString(), Is.EqualTo("25,0"));
}