Beispiel #1
0
 static void TestInvalid(int testId, int nbr)
 {
     try {
         var result = Arithmetic.sqr(nbr);
         Console.WriteLine($"Test #{testId}: Fail");
     } catch (Exception) {
         Console.WriteLine($"Test #{testId}: Pass");
     }
 }
Beispiel #2
0
 static void TestValid(int testId, int nbr, int expected)
 {
     try {
         var actual = Arithmetic.sqr(nbr);
         if (actual == expected)
         {
             Console.WriteLine($"Test #{testId}: Pass");
         }
         else
         {
             Console.WriteLine($"Test #{testId}: Fail");
         }
     } catch (Exception) {
         Console.WriteLine($"Test #{testId}: Fail");
     }
 }