Пример #1
0
        public void PrintMatrix_SixDimensionalMatrix_ShouldPrintCorrectMatrix()
        {
            // Arrange
            using (var sr = new StringReader("6"))
            {
                using (var sw = new StringWriter())
                {
                    Console.SetIn(sr);
                    Console.SetOut(sw);

                    // Act
                    RotatingWalkInMatrixMain.Main();
                    string expected = string.Format("{0}\r\n{1}\r\n{2}\r\n{3}\r\n{4}\r\n{5}\r\n",
                                                    "  1 16 17 18 19 20",
                                                    " 15  2 27 28 29 21",
                                                    " 14 31  3 26 30 22",
                                                    " 13 36 32  4 25 23",
                                                    " 12 35 34 33  5 24",
                                                    " 11 10  9  8  7  6");

                    // Assert
                    Assert.IsTrue(sw.ToString().Contains(expected));
                }
            }
        }
 public void RotatingInMatrixMain_ShouldPassIfTheGivenParameteresAreValid()
 {
     Assert.DoesNotThrow(() => RotatingWalkInMatrixMain.Main());
 }