public void Are_adjacent_on_right_left_borders(
            string firstTileDescription,
            string secondTileDescription)
        {
            // Given
            Tile first  = TilesParser.ParseOne(firstTileDescription);
            Tile second = TilesParser.ParseOne(secondTileDescription);

            // When
            var(areAdjacent, fromBorder, toBorder) = Tile.AreAdjacent(first, second);

            // Then
            CheckRightLeftAdjacentBorders(areAdjacent, fromBorder, toBorder);
        }
示例#2
0
        public void What_do_you_get_if_you_multiply_together_the_IDs_of_the_four_corner_tiles(
            string cameraArrayDescription,
            long expectedCameraArrayCornerProduct)
        {
            // Given
            var tiles = TilesParser.ParseAll(cameraArrayDescription);

            // When
            var ids = CameraArray.FindCornerIds(tiles);

            var actualCameraArrayCornerProduct = ids.Aggregate(1L, (acc, tileId) => acc * tileId);

            // Then
            Assert.Equal(expectedCameraArrayCornerProduct, actualCameraArrayCornerProduct);
        }
        public void Find_orientation_for_adjacent_with_all_orientations(
            string firstTileDescription,
            string secondTileDescription)
        {
            // Given
            Tile first  = TilesParser.ParseOne(firstTileDescription);
            Tile second = TilesParser.ParseOne(secondTileDescription);

            // When
            (first, second) = Tile.FindAdjacentOrientation(first, second);
            var(areAdjacent, fromBorder, toBorder) = Tile.AreAdjacent(first, second);

            // Then
            Assert.True(areAdjacent);
        }
        public void Are_adjacent_on_right_left_borders_after_horizontal_flip(
            string firstTileDescription,
            string secondTileDescription)
        {
            // Given
            Tile first  = TilesParser.ParseOne(firstTileDescription);
            Tile second = TilesParser.ParseOne(secondTileDescription);

            // When
            first  = first.VerticalFlip();
            second = second.HorizontalFlip();
            var(areAdjacent, fromBorder, toBorder) = Tile.AreAdjacent(first, second);

            // Then
            CheckRightLeftAdjacentBorders(areAdjacent, fromBorder, toBorder);
        }