Exemple #1
0
        static void Main()
        {
            WalkInMatrix matrix = new WalkInMatrix(2);

            matrix.Walk();
            matrix.Print();
        }
Exemple #2
0
        public static void Main()
        {
            var reader = new Reader();
            var writer = new Writer();
            var walk   = new WalkInMatrix(reader, writer);

            walk.Execute();
        }
        public void ToString_MatrixOfOneCell()
        {
            WalkInMatrix matrix = new WalkInMatrix(1);
            matrix.FillMatrix();

            var expected = "  1" + Environment.NewLine;
            var actual = matrix.ToString();
            Assert.AreEqual(expected, actual);
        }
Exemple #4
0
        public static void Main()
        {
            Console.Write("Enter matrix size : ");
            WalkInMatrix matrix = new WalkInMatrix(int.Parse(Console.ReadLine()));

            matrix.FillMatrix();

            Console.Write(matrix);
        }
Exemple #5
0
        private static void Main()
        {
            var n            = ReadInput();
            var walkInMatrix = new WalkInMatrix(n);

            walkInMatrix.Run();
            var writer = new ConsoleWriter();

            walkInMatrix.PrintMatrix(writer);
        }
        public void ToString_MatrixOfSixCells()
        {
            WalkInMatrix matrix = new WalkInMatrix(6);
            matrix.FillMatrix();
            var actual = matrix.ToString();

            StringBuilder sb = new StringBuilder();
            sb.Append("  1 16 17 18 19 20");
            sb.Append(Environment.NewLine);
            sb.Append(" 15  2 27 28 29 21");
            sb.Append(Environment.NewLine);
            sb.Append(" 14 35  3 26 30 22");
            sb.Append(Environment.NewLine);
            sb.Append(" 13 34 36  4 25 23");
            sb.Append(Environment.NewLine);
            sb.Append(" 12 33 32 31  5 24");
            sb.Append(Environment.NewLine);
            sb.Append(" 11 10  9  8  7  6");
            sb.Append(Environment.NewLine);

            var expected = sb.ToString();

            Assert.AreEqual(expected, actual);
        }
 static void Main(string[] args)
 {
     WalkInMatrix matrix = new WalkInMatrix(6);
     Console.WriteLine(matrix);
 }
 public void IndexOutOfRangeException()
 {
     WalkInMatrix matrix = new WalkInMatrix(2);
     int exceptionExpected = matrix[2, 2];
 }
 public void Constructor_MatrixOfZeroCellsException()
 {
     WalkInMatrix matrix = new WalkInMatrix(0);
 }