Beispiel #1
0
    public void No_rectangles()
    {
        var strings = new[]
        {
            " "
        };

        Assert.Equal(0, Rectangles.Count(strings));
    }
Beispiel #2
0
    public void Number_1x1_square_is_counted()
    {
        var strings = new[]
        {
            "++",
            "++"
        };

        Assert.Equal(1, Rectangles.Count(strings));
    }
Beispiel #3
0
    public void Rectangle_of_height_1_is_counted()
    {
        var strings = new[]
        {
            "+--+",
            "+--+"
        };

        Assert.Equal(1, Rectangles.Count(strings));
    }
Beispiel #4
0
    public void One_rectangle()
    {
        var strings = new[]
        {
            "+-+",
            "| |",
            "+-+"
        };

        Assert.Equal(1, Rectangles.Count(strings));
    }
Beispiel #5
0
    public void Rectangle_of_width_1_is_counted()
    {
        var strings = new[]
        {
            "++",
            "||",
            "++"
        };

        Assert.Equal(1, Rectangles.Count(strings));
    }
Beispiel #6
0
    public void One_rectangle()
    {
        var input = new[]
        {
            "+-+",
            "| |",
            "+-+"
        };

        Assert.That(Rectangles.Count(input), Is.EqualTo(1));
    }
Beispiel #7
0
    public void One_rectangle()
    {
        var input = new[]
        {
            "+-+",
            "| |",
            "+-+"
        };

        Assert.Equal(1, Rectangles.Count(input));
    }
Beispiel #8
0
    public void Two_rectangles_without_shared_parts()
    {
        var strings = new[]
        {
            "  +-+",
            "  | |",
            "+-+-+",
            "| |  ",
            "+-+  "
        };

        Assert.Equal(2, Rectangles.Count(strings));
    }
Beispiel #9
0
    public void Corner_is_required_for_a_rectangle_to_be_complete()
    {
        var strings = new[]
        {
            "+------+----+",
            "|      |    |",
            "+------+    |",
            "|   |       |",
            "+---+-------+"
        };

        Assert.Equal(2, Rectangles.Count(strings));
    }
Beispiel #10
0
    public void Rectangles_can_be_of_different_sizes()
    {
        var strings = new[]
        {
            "+------+----+",
            "|      |    |",
            "+---+--+    |",
            "|   |       |",
            "+---+-------+"
        };

        Assert.Equal(3, Rectangles.Count(strings));
    }
Beispiel #11
0
    public void Only_complete_rectangles_are_counted()
    {
        var strings = new[]
        {
            "  +-+",
            "    |",
            "+-+-+",
            "| | -",
            "+-+-+"
        };

        Assert.Equal(1, Rectangles.Count(strings));
    }
Beispiel #12
0
    public void Five_rectangles_with_shared_parts()
    {
        var strings = new[]
        {
            "  +-+",
            "  | |",
            "+-+-+",
            "| | |",
            "+-+-+"
        };

        Assert.Equal(5, Rectangles.Count(strings));
    }
Beispiel #13
0
    public void Rectangles_can_be_of_different_sizes()
    {
        var input = new[]
        {
            "+------+----+",
            "|      |    |",
            "+---+--+    |",
            "|   |       |",
            "+---+-------+"
        };

        Assert.That(Rectangles.Count(input), Is.EqualTo(3));
    }
Beispiel #14
0
    public void Only_complete_rectangles_are_counted()
    {
        var input = new[]
        {
            "  +-+",
            "    |",
            "+-+-+",
            "| | -",
            "+-+-+"
        };

        Assert.That(Rectangles.Count(input), Is.EqualTo(1));
    }
Beispiel #15
0
    public void Corner_is_required_for_a_rectangle_to_be_complete()
    {
        var input = new[]
        {
            "+------+----+",
            "|      |    |",
            "+------+    |",
            "|   |       |",
            "+---+-------+"
        };

        Assert.That(Rectangles.Count(input), Is.EqualTo(2));
    }
Beispiel #16
0
    public void Five_rectangles_with_shared_parts()
    {
        var input = new[]
        {
            "  +-+",
            "  | |",
            "+-+-+",
            "| | |",
            "+-+-+"
        };

        Assert.That(Rectangles.Count(input), Is.EqualTo(5));
    }
Beispiel #17
0
    public void Large_input_with_many_rectangles()
    {
        var input = new[]
        {
            "+---+--+----+",
            "|   +--+----+",
            "+---+--+    |",
            "|   +--+----+",
            "+---+--+--+-+",
            "+---+--+--+-+",
            "+------+  | |",
            "          +-+"
        };

        Assert.That(Rectangles.Count(input), Is.EqualTo(60));
    }
Beispiel #18
0
    public void Large_input_with_many_rectangles()
    {
        var strings = new[]
        {
            "+---+--+----+",
            "|   +--+----+",
            "+---+--+    |",
            "|   +--+----+",
            "+---+--+--+-+",
            "+---+--+--+-+",
            "+------+  | |",
            "          +-+"
        };

        Assert.Equal(60, Rectangles.Count(strings));
    }
Beispiel #19
0
    public void No_rectangles()
    {
        var input = new[] { " " };

        Assert.Equal(0, Rectangles.Count(input));
    }
Beispiel #20
0
    public void No_rows()
    {
        var input = new string[0];

        Assert.That(Rectangles.Count(input), Is.EqualTo(0));
    }
Beispiel #21
0
    public void No_rows()
    {
        var input = new string[0];

        Assert.Equal(0, Rectangles.Count(input));
    }
Beispiel #22
0
    public void No_rectangles()
    {
        var input = new[] { " " };

        Assert.That(Rectangles.Count(input), Is.EqualTo(0));
    }
Beispiel #23
0
    public void No_rows()
    {
        var strings = Array.Empty <string>();

        Assert.Equal(0, Rectangles.Count(strings));
    }
Beispiel #24
0
    public void No_rows()
    {
        var strings = new string[0];

        Assert.Equal(0, Rectangles.Count(strings));
    }