static void Main(string[] args)
        {
            var calendar = new MyCalendar();

            calendar.Book(10, 20);
            calendar.Book(15, 25);
            calendar.Book(20, 30);
        }
示例#2
0
        public static void CallMyCalendar()
        {
            Console.WriteLine("My Calendar:");

            bool       test = true;
            MyCalendar obj  = new MyCalendar();

            Console.Write("Test Case 1: ");
            if (obj.Book(10, 20) == false)
            {
                test = false;                            // returns true
            }
            if (obj.Book(15, 25) == true)
            {
                test = false;                           // returns false
            }
            if (obj.Book(20, 30) == false)
            {
                test = false;                            // returns true
            }
            Console.WriteLine(test);

            obj  = new MyCalendar();
            test = true;
            Console.Write("Test Case 2: ");
            if (obj.Book(5, 8) == false)
            {
                test = false;                          // returns true
            }
            if (obj.Book(20, 25) == false)
            {
                test = false;                            // returns true
            }
            if (obj.Book(30, 40) == false)
            {
                test = false;                            // returns true
            }
            if (obj.Book(8, 27) == false)
            {
                test = true;                           // returns false
            }
            if (obj.Book(27, 28) == false)
            {
                test = false;                            // returns true
            }
            if (obj.Book(27, 37) == false)
            {
                test = true;                            // returns false
            }
            if (obj.Book(25, 26) == false)
            {
                test = false;                            // returns true
            }
            if (obj.Book(26, 27) == false)
            {
                test = false;                            // returns true
            }
            Console.WriteLine(test);

            Console.ReadLine();
        }