Beispiel #1
0
        /// <summary>
        ///     Creates coordinate object from single string
        ///     Coordinate in text in given manner: 'A4'
        ///     Where 'A' is row and '4' is column
        /// </summary>
        /// <param name="coordinate">Coordinate as single string (e.g. 'A4')</param>
        /// <returns>Coordinate object</returns>
        public static Coordinate Create(string coordinate)
        {
            CoordinateConverter.SplitLettersFromNumbers(coordinate, out string row, out int column);

            return(new Coordinate(
                       CoordinateConverter.ConvertUserInputRowToBoardRow(row),
                       CoordinateConverter.ConvertUserInputNumberToBoardColumnNumber(column)));
        }
Beispiel #2
0
 /// <summary>
 ///     Creates coordinate object from string row and number column
 /// </summary>
 /// <param name="row">Row (e.g. 'A' or 'D')</param>
 /// <param name="column">Column (e.g. '4', '9')</param>
 /// <returns>Coordinate object</returns>
 public static Coordinate Create(string row, int column)
 {
     return(new Coordinate(
                CoordinateConverter.ConvertUserInputRowToBoardRow(row),
                CoordinateConverter.ConvertUserInputNumberToBoardColumnNumber(column)));
 }
Beispiel #3
0
        public void CanConvertUserInputNumberToBoardColumnNumber(int userInputColumnNumber, int expectedGameColumnNumber)
        {
            int result = CoordinateConverter.ConvertUserInputNumberToBoardColumnNumber(userInputColumnNumber);

            Assert.AreEqual(expectedGameColumnNumber, result);
        }