예제 #1
0
        public void InsertLineIntoMatrixHappyPath()
        {
            var matrix = new string[2, 2];
            var data   = new string[] { "a", "b" };

            WordSearch.InsertLineIntoMatrix(matrix, data, 0);
            Assert.Equal("a", matrix[0, 0]);
            Assert.Equal("b", matrix[1, 0]);
            Assert.Null(matrix[0, 1]);
            Assert.Null(matrix[1, 1]);
        }
예제 #2
0
        public void InsertLineIntoMatrixGarbageData()
        {
            var matrix = new string[2, 2];
            var data   = new string[] { "a" };

            Assert.Throws <ArgumentException>(() => WordSearch.InsertLineIntoMatrix(matrix, data, 0));

            data = new string[] { "a", "b" };
            Assert.Throws <IndexOutOfRangeException>(() => WordSearch.InsertLineIntoMatrix(matrix, data, 2));

            Assert.Throws <NullReferenceException>(() => WordSearch.InsertLineIntoMatrix(null, data, 0));
            Assert.Throws <NullReferenceException>(() => WordSearch.InsertLineIntoMatrix(matrix, null, 0));
        }