public void RunTaskStackOverflowAndIndexOutofRangeExceptions() { Console.WriteLine("____________Task Exceptions____________"); ExceptionsGenerator exceptionsViewer = new ExceptionsGenerator(new ConsolePrinter()); exceptionsViewer.GenereteIndexOutOfRangeException(); exceptionsViewer.GenerateInfiniteRecursion(8); }
public void RunTaskArgumentExceptions() { Console.WriteLine("____________Task Argument Exception____________"); ExceptionsGenerator exceptionsViewer = new ExceptionsGenerator(new ConsolePrinter()); Console.WriteLine("Please, enter a: "); string aFromConsole = Console.ReadLine(); Console.WriteLine("Please, enter b: "); string bFromConsole = Console.ReadLine(); int convertedA = 0; int convertedB = 0; if (Int32.TryParse(aFromConsole, out convertedA) && Int32.TryParse(bFromConsole, out convertedB)) { exceptionsViewer.DoSomeMath(convertedA, convertedB); } else { Console.WriteLine("Incorrect input: a or b is not a number"); } }