public void Size1Matrix()
 {
     int n = 1;
     int[,] expected = { { 1 } };
     var result = new WalkMatrix(n);
     Assert.IsTrue(this.CompareMatrix(expected, result.Matrix));
 }
 public void Size4Matrix()
 {
     int n = 4;
     int[,] expected =
         {
             { 1,  10,  11,  12 },
             { 9,   2,  15,  13 },
             { 8,  16,   3,  14 },
             { 7,   6,   5,   4 }
         };
     var result = new WalkMatrix(n);
     Assert.IsTrue(this.CompareMatrix(expected, result.Matrix));
 }
 public void Size6Matrix()
 {
     int n = 6;
     int[,] expected =
         {
             { 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 }
         };
     var result = new WalkMatrix(n);
     Assert.IsTrue(this.CompareMatrix(expected, result.Matrix));
 }
Example #4
0
    public static void Main(string[] args)
    {
        Console.WriteLine("Enter a number between 1 and 100");
        string input;
        int n = 0;

        input = Console.ReadLine();
        if (!int.TryParse(input, out n))
        {
            throw new ArgumentException("Invalid number!");
        }

        var matrix = new WalkMatrix(n);
        Console.WriteLine(matrix.ToString());
    }
 public void Size100MatrixShouldNotThrow()
 {
     int n = 100;
     var result = new WalkMatrix(n);
 }
 public void Size101MatrixShouldThrow()
 {
     int n = 101;
     var result = new WalkMatrix(n);
 }
 public void Size0MatrixShouldThrow()
 {
     int n = 0;
     var result = new WalkMatrix(n);
 }