Exemplo n.º 1
0
    public static void Y2015_Day18_GetGridConfigurationAfterSteps()
    {
        // Arrange
        string[] initialState = new string[]
        {
            ".#.#.#",
            "...##.",
            "#....#",
            "..#...",
            "#.#..#",
            "####..",
        };

        int  steps = 0;
        bool areCornerLightsBroken = false;

        // Act
        IList <string> actual = Day18.GetGridConfigurationAfterSteps(initialState, steps, areCornerLightsBroken);

        // Assert
        actual.ShouldNotBeNull();
        actual.ShouldBe(
            new[]
        {
            ".#.#.#",
            "...##.",
            "#....#",
            "..#...",
            "#.#..#",
            "####..",
        });

        // Arrange
        steps = 4;

        // Act
        actual = Day18.GetGridConfigurationAfterSteps(initialState, steps, areCornerLightsBroken);

        // Assert
        actual.ShouldNotBeNull();
        actual.ShouldBe(
            new[]
        {
            "......",
            "......",
            "..##..",
            "..##..",
            "......",
            "......",
        });

        // Arrange
        steps = 5;
        areCornerLightsBroken = true;

        // Act
        actual = Day18.GetGridConfigurationAfterSteps(initialState, steps, areCornerLightsBroken);

        // Assert
        actual.ShouldNotBeNull();
        actual.ShouldBe(
            new[]
        {
            "##.###",
            ".##..#",
            ".##...",
            ".##...",
            "#.#...",
            "##...#",
        });
    }