예제 #1
0
 public void ReportPositionAndPanalties(IPosition position)
 {
     Console.WriteLine("Current X Coordinate is : " + position.GetXCoordinate());
     Console.WriteLine("Current Y Coordinate is : " + position.GetYCoordinate());
     Console.WriteLine("Current Direction is : " + position.GetCurrentDirection());
     Console.WriteLine("Current Panalties is : " + position.GetPanalties());
 }
예제 #2
0
 private void PerformCheck()
 {
     Assert.AreEqual(_expectedPosition.GetXCoordinate(), _actualPosition.GetXCoordinate());
     Assert.AreEqual(_expectedPosition.GetYCoordinate(), _actualPosition.GetYCoordinate());
     Assert.AreEqual(_expectedPosition.GetCurrentDirection(), _actualPosition.GetCurrentDirection());
     Assert.AreEqual(_expectedPosition.GetPanalties(), _actualPosition.GetPanalties());
 }
예제 #3
0
        public IPosition Move()
        {
            var currentDirection = _position.GetCurrentDirection();

            if (currentDirection.Equals(Direction.East))
            {
                _position = _position.MoveForewordOnXCoordinate();
            }
            if (currentDirection.Equals(Direction.West))
            {
                _position = _position.MoveBackwordOnXCoordinate();
            }
            if (currentDirection.Equals(Direction.North))
            {
                _position = _position.MoveForewordOnYCoordinate();
            }
            if (currentDirection.Equals(Direction.South))
            {
                _position = _position.MoveBackwordOnYCoordinate();
            }
            return(_position);
        }