Beispiel #1
0
        public void Test01_For_NbyM_Grid()
        {
            // Arrange
            var instance = new WordSearchII();
            var grid     = new char[, ]
            {
                { 'a', 'a' }
            };
            var dictionary = new List <string> {
                "aaa"
            };

            // Act
            var wordsFound = instance.FindDictionaryWordsInTheGrid(dictionary, grid);

            // Assert
            Assert.AreEqual(0, wordsFound.ToList().Count);
        }
Beispiel #2
0
        public void Test01_For_NbyN_Grid()
        {
            // Arrange
            var instance = new WordSearchII();
            var grid     = new char[, ]
            {
                { 'o', 'a', 'a', 'n' },
                { 'e', 't', 'a', 'e' },
                { 'i', 'h', 'k', 'r' },
                { 'i', 'f', 'l', 'v' }
            };
            var dictionary = new List <string> {
                "oath", "pea", "eat", "rain"
            };

            // Act
            var wordsFound = instance.FindDictionaryWordsInTheGrid(dictionary, grid);

            // Assert
            Assert.AreEqual(2, wordsFound.ToList().Count);
        }