Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var terminator = "Y";

            while (terminator.ToUpper() == "Y")
            {
                var list      = LoadList();
                var niceArray = new NiceArray();
                try
                {
                    var results = niceArray.IsNice(list);
                    Console.WriteLine(results);
                }
                catch (Exception exception)
                {
                    Console.WriteLine(exception.Message);
                }
                Console.WriteLine();
                Console.WriteLine("Press 'Y' to continue checking other possibilities else any key to exit");
                terminator = Console.ReadLine();
            }
            Console.ReadKey();
        }
Exemplo n.º 2
0
 public void SampleTest()
 {
     Assert.AreEqual(true, NiceArray.IsNice(new int[] { 2, 10, 9, 3 }));
     Assert.AreEqual(false, NiceArray.IsNice(new int[] { 3, 4, 5, 7 }));
     Assert.AreEqual(true, NiceArray.IsNice(new int[] { 3, 2, 1, 0 }));
 }