示例#1
0
    public void Should_find_diagonal_words_written_top_left_to_bottom_right()
    {
        var wordSearch = new WordSearch(Puzzle);
        var actual     = wordSearch.Find("java");

        Assert.That(actual, Is.EqualTo(Tuple.Create(new Point(1, 1), new Point(4, 4))));
    }
示例#2
0
    public void Should_not_find_words_that_are_not_in_the_puzzle()
    {
        var wordSearch = new WordSearch(Puzzle);
        var actual     = wordSearch.Find("haskell");

        Assert.Null(actual);
    }
示例#3
0
    public void Should_find_diagonal_upper_written_top_right_to_bottom_left()
    {
        var wordSearch = new WordSearch(Puzzle);
        var actual     = wordSearch.Find("ruby");

        Assert.That(actual, Is.EqualTo(Tuple.Create(new Point(8, 6), new Point(5, 9))));
    }
示例#4
0
    public void Should_find_vertical_words_written_bottom_to_top()
    {
        var wordSearch = new WordSearch(Puzzle);
        var actual     = wordSearch.Find("rust");

        Assert.That(actual, Is.EqualTo(Tuple.Create(new Point(9, 5), new Point(9, 2))));
    }
示例#5
0
    public void Should_find_vertical_words_written_top_to_bottom()
    {
        var wordSearch = new WordSearch(Puzzle);
        var actual     = wordSearch.Find("ecmascript");

        Assert.That(actual, Is.EqualTo(Tuple.Create(new Point(10, 1), new Point(10, 10))));
    }
示例#6
0
    public void Should_find_horizontal_words_written_right_to_left()
    {
        var wordSearch = new WordSearch(Puzzle);
        var actual     = wordSearch.Find("elixir");

        Assert.That(actual, Is.EqualTo(Tuple.Create(new Point(6, 5), new Point(1, 5))));
    }
示例#7
0
    public void Should_find_horizontal_words_written_left_to_right()
    {
        var wordSearch = new WordSearch(Puzzle);
        var actual     = wordSearch.Find("clojure");

        Assert.That(actual, Is.EqualTo(Tuple.Create(new Point(1, 10), new Point(7, 10))));
    }
示例#8
0
    public void Should_find_diagonal_upper_written_top_right_to_bottom_left()
    {
        var wordSearch = new WordSearch(Puzzle);
        var actual     = wordSearch.Find("ruby");

        Assert.Equal(new Tuple <int, int>(8, 6), actual.Item1);
        Assert.Equal(new Tuple <int, int>(5, 9), actual.Item2);
    }
示例#9
0
    public void Should_find_diagonal_words_written_top_left_to_bottom_right()
    {
        var wordSearch = new WordSearch(Puzzle);
        var actual     = wordSearch.Find("java");

        Assert.Equal(new Tuple <int, int>(1, 1), actual.Item1);
        Assert.Equal(new Tuple <int, int>(4, 4), actual.Item2);
    }
示例#10
0
    public void Should_find_vertical_words_written_bottom_to_top()
    {
        var wordSearch = new WordSearch(Puzzle);
        var actual     = wordSearch.Find("rust");

        Assert.Equal(new Tuple <int, int>(9, 5), actual.Item1);
        Assert.Equal(new Tuple <int, int>(9, 2), actual.Item2);
    }
示例#11
0
    public void Should_find_vertical_words_written_top_to_bottom()
    {
        var wordSearch = new WordSearch(Puzzle);
        var actual     = wordSearch.Find("ecmascript");

        Assert.Equal(new Tuple <int, int>(10, 1), actual.Item1);
        Assert.Equal(new Tuple <int, int>(10, 10), actual.Item2);
    }
示例#12
0
    public void Should_find_horizontal_words_written_right_to_left()
    {
        var wordSearch = new WordSearch(Puzzle);
        var actual     = wordSearch.Find("elixir");

        Assert.Equal(new Tuple <int, int>(6, 5), actual.Item1);
        Assert.Equal(new Tuple <int, int>(1, 5), actual.Item2);
    }
示例#13
0
    public void Should_find_horizontal_words_written_left_to_right()
    {
        var wordSearch = new WordSearch(Puzzle);
        var actual     = wordSearch.Find("clojure");

        Assert.Equal(new Tuple <int, int>(1, 10), actual.Item1);
        Assert.Equal(new Tuple <int, int>(7, 10), actual.Item2);
    }
示例#14
0
    public void Should_be_able_to_search_differently_sized_puzzles()
    {
        const string differentSizePuzzle =
            "qwertyuiopz\n" +
            "luamsicrexe\n" +
            "abcdefghijk";
        var wordSearch = new WordSearch(differentSizePuzzle);

        var actual = wordSearch.Find("exercism");

        Assert.That(actual, Is.EqualTo(Tuple.Create(new Point(11, 2), new Point(4, 2))));
    }
示例#15
0
    public void Should_be_able_to_search_differently_sized_puzzles()
    {
        const string differentSizePuzzle =
            "qwertyuiopz\n" +
            "luamsicrexe\n" +
            "abcdefghijk";
        var wordSearch = new WordSearch(differentSizePuzzle);

        var actual = wordSearch.Find("exercism");

        Assert.Equal(new Tuple <int, int>(11, 2), actual.Item1);
        Assert.Equal(new Tuple <int, int>(4, 2), actual.Item2);
    }