本文整理汇总了C#中Rover.Move方法的典型用法代码示例。如果您正苦于以下问题:C# Rover.Move方法的具体用法?C# Rover.Move怎么用?C# Rover.Move使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rover
的用法示例。
在下文中一共展示了Rover.Move方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AsARoverIShouldDecrementMyXPositionWhenMovingToWest
public void AsARoverIShouldDecrementMyXPositionWhenMovingToWest()
{
var rover = new Rover(new West(), new Coordinate("1 0"), _terrain);
rover.Move();
Assert.AreEqual("0 0 W", rover.Position);
}
示例2: AsARoverIShouldRaiseAnExceptionBeforeMovingToAInvalidTerrainUpperBoundaryXAxisValue
public void AsARoverIShouldRaiseAnExceptionBeforeMovingToAInvalidTerrainUpperBoundaryXAxisValue()
{
var rover = new Rover(new East(), new Coordinate("1 0"), _terrain);
rover.Move();
Assert.AreEqual("1 0 E", rover.Position);
}
示例3: AsARoverIShouldIncrementMyYPositionWhenMovingToNorth
public void AsARoverIShouldIncrementMyYPositionWhenMovingToNorth()
{
var rover = new Rover(new North(), new Coordinate("0 0"), _terrain);
rover.Move();
Assert.AreEqual("0 1 N", rover.Position);
}
示例4: AsARoverIShouldRaiseAnExceptionBeforeMovingToAInvalidTerrainLowerBoundaryXAxisValue
public void AsARoverIShouldRaiseAnExceptionBeforeMovingToAInvalidTerrainLowerBoundaryXAxisValue()
{
var terrain = new Terrain(new Coordinate("1 1"));
var rover = new Rover(new West(), new Coordinate("0 0"), _terrain);
rover.Move();
Assert.AreEqual("0 0 W", rover.Position);
}
示例5: AsARoverIShouldRaiseAnExceptionBeforeMovingToInvalidTerrainLowerBoundaryYAxisValue
public void AsARoverIShouldRaiseAnExceptionBeforeMovingToInvalidTerrainLowerBoundaryYAxisValue()
{
var rover = new Rover(new South(), new Coordinate("0 0"), _terrain);
rover.Move();
Assert.AreEqual("0 0 S", rover.Position);
}
示例6: Alters_position_and_direction_in_response_to_movement_list
public void Alters_position_and_direction_in_response_to_movement_list(int startX, int startY,
CardinalDirection startDirection, Movement firstMove, Movement secondMove, Movement thirdMove,
int expectedX, int expectedY, CardinalDirection expectedDirection)
{
var startPosition = new Point(startX, startY);
var expectedPosition = new Point(expectedX, expectedY);
var movements = new List<Movement> {firstMove, secondMove, thirdMove};
var mockLandingSurface = new Mock<ILandingSurface>();
mockLandingSurface.Setup(x => x.IsValid(startPosition)).Returns(true);
var rover = new Rover();
rover.Deploy(mockLandingSurface.Object, startPosition, startDirection);
rover.Move(movements);
Assert.AreEqual(expectedPosition.X, rover.Position.X);
Assert.AreEqual(expectedPosition.Y, rover.Position.Y);
Assert.AreEqual(expectedDirection, rover.CardinalDirection);
}
示例7: Execute
public void Execute(Rover rover)
{
rover.Move();
}
示例8: Move_InitialStateIs00E_FinalStateShouldBe10E
public void Move_InitialStateIs00E_FinalStateShouldBe10E()
{
// Arrange
var rover = new Rover();
var initialCoordinates = new Coordinates(0, 0);
rover.Init(initialCoordinates, new EastOrientation());
// Act
rover.Move();
//Assert
Assert.That(rover.Coordinates, Is.EqualTo(new Coordinates(1, 0)));
}
示例9: Move_InitialStateIs55NAndPlateauIsSetTo55_OutOfPlateauException
public void Move_InitialStateIs55NAndPlateauIsSetTo55_OutOfPlateauException()
{
// Arrange
var rover = new Rover();
var initialCoordinates = new Coordinates(5, 5);
rover.Init(initialCoordinates, new NorthOrientation());
var upperLeft = new Coordinates(5, 5);
var plateau = new Plateau(upperLeft);
rover.SetPlateau(plateau);
// Act
rover.Move();
}
示例10: Move_InitialStateIs33WAndPlateauIsSetTo55_TheNewCoordinatesShouldBe23W
public void Move_InitialStateIs33WAndPlateauIsSetTo55_TheNewCoordinatesShouldBe23W()
{
// Arrange
var rover = new Rover();
var initialCoordinates = new Coordinates(3, 3);
rover.Init(initialCoordinates, new WestOrientation());
var upperLeft = new Coordinates(5, 5);
var plateau = new Plateau(upperLeft);
rover.SetPlateau(plateau);
// Act
rover.Move();
// Assert
Assert.That(rover.Coordinates, Is.EqualTo(new Coordinates(2, 3)));
Assert.That(rover.Orientation, Is.EqualTo(new WestOrientation()));
}