コード例 #1
0
        public void ListCoordsFromShipCountShouldBe4ForShipKindOfFour()
        {
            //Given
            InputParser parser = new InputParser();

            int[] coords   = parser.ChangeCordsToIndexes("I6");
            int   expected = 6;

            //When
            Ship ship   = new Ship(KindOfShip.Six, coords, Direction.Up);
            int  result = ship.Coords.Count;

            //Then
            Assert.AreEqual(expected, result);
        }
コード例 #2
0
        public void ShouldReturn9and9WhenInputIsJ10()
        {
            //Given
            string coords = "J10";

            int[] expected = new int[] { 9, 9 };

            //When
            InputParser parser = new InputParser();

            int[] result = parser.ChangeCordsToIndexes(coords);

            //Then
            Assert.AreEqual(expected[0], result[0]);
            Assert.AreEqual(expected[1], result[1]);
        }
コード例 #3
0
        public void LastCoordsShipKindSixShouldBe4and6ForStartCoordsJ6()
        {
            //Given
            InputParser parser = new InputParser();

            int[] coords   = parser.ChangeCordsToIndexes("J6");
            int[] expected = new[] { 4, 5 };

            //When
            Ship ship = new Ship(KindOfShip.Six, coords, Direction.Up);

            int[] result = ship.Coords[5];

            //Then
            CollectionAssert.AreEqual(expected, result);
            ;
        }