Example #1
0
        /// <summary>
        /// Begin iterating random words to test robustness of API.
        /// </summary>
        private static void BeginRandomLookups()
        {
            for (int i = 0; i < LOOKUPS; i++)
            {
                Thread.Sleep(INTERVAL);

                try
                {
                    NinjaTerm term = Ninja.GetRandomTerm();
                    Console.WriteLine((i + 1) + ": " + term.Term);
                }
                catch (WebException)
                {
                    Console.WriteLine("****************");
                    Console.WriteLine("WebException");
                    Console.WriteLine("****************");
                }
                catch (CategoryNotEnumeratedException ex)
                {
                    Console.WriteLine("****************");
                    Console.WriteLine("CategoryNotEnumeratedException on category: " + ex.CategoryString);
                    Console.WriteLine("****************");
                }
            }

            Console.ReadLine();
        }