Beispiel #1
0
        public void AddMovieCheck()
        {
            var movie = new Movie();

            movie.MovieName = "The Devil Wears Prada";
            movie.MainActor = "Meryl Streep";
            movie.Genre     = "Comedy";
            movie.Director  = "David Frankel";
            movie.Rating    = "PG-13";

            var result = MovieMenu.AddMovie();

            Assert.Equal(movie, result);
        }
Beispiel #2
0
        public void Run()
        {
            int choice = 0;

            do
            {
                IMenu movieMenu = new MovieMenu();
                choice = movieMenu.PrintMenu();
                switch (choice)
                {
                case (int)MovieMenuOption.Insert:
                    AddMovieAsync().Wait();
                    break;

                case (int)MovieMenuOption.Delete:
                    DeleteMovieAsync().Wait();
                    break;

                case (int)MovieMenuOption.Print:
                    PrintAllAsync().Wait();
                    break;

                case (int)MovieMenuOption.Update:
                    UpdateMovieAsync().Wait();
                    break;

                case (int)MovieMenuOption.GetMovieById:
                    PrintMovieByIdAsync().Wait();
                    break;

                case (int)MovieMenuOption.Exit:
                    Console.WriteLine("Thanks for your visit. Please visit the Movie Menu again !!!!");
                    break;

                default:
                    Console.WriteLine("Invalid Option");
                    break;
                }

                if (choice != (int)MovieMenuOption.Exit)
                {
                    //Console.WriteLine("genre " + choice);
                    Console.WriteLine("Press Enter to continue.......");
                    Console.ReadLine();
                    Console.Clear();
                }
            } while (choice != (int)MovieMenuOption.Exit);
        }
Beispiel #3
0
        public void RunAsync()
        {
            int       choice = 0;
            MovieMenu m      = new MovieMenu();

            do
            {
                choice = m.PrintMenu();

                switch (choice)
                {
                case (int)MovieOption.Insert:
                    AddMovieAsync().Wait();
                    break;

                case (int)MovieOption.Update:
                    UpdateMovieAsync().Wait();
                    break;

                case (int)MovieOption.Delete:
                    DeleteMovieAsync().Wait();
                    break;

                case (int)MovieOption.PrintAll:
                    PrintAllAsync().Wait();
                    break;

                case (int)MovieOption.PrintById:
                    PrintByIdAsync().Wait();
                    break;

                case (int)MovieOption.Exit:
                    Console.WriteLine("Thanks for visit. Please Visit Again!!!!");
                    break;

                default:
                    Console.WriteLine("Invalid Option");
                    break;
                }
                if (choice != (int)MovieOption.Exit)
                {
                    Console.WriteLine("Press Enter to continue......");
                    Console.ReadLine();
                    Console.Clear();
                }
            } while (choice != (int)MovieOption.Exit);
        }
Beispiel #4
0
        public async void Run()
        {
            int choice = 0;

            do
            {
                IMenu movieMenu = new MovieMenu();
                choice = movieMenu.PrintMenu();
                switch (choice)
                {
                case (int)MovieMenuOptions.Insert:
                    //await AddMovieAsync();
                    AddMovieAsync().Wait();
                    break;

                case (int)MovieMenuOptions.Delete:
                    //await DeleteMovieAsync();
                    DeleteMovieAsync().Wait();
                    break;

                case (int)MovieMenuOptions.Print:
                    //await PrintAllAsync();
                    PrintAllAsync().Wait();
                    break;

                case (int)MovieMenuOptions.Update:
                    //await UpdateMovieAsync();
                    UpdateMovieAsync().Wait();
                    break;

                case (int)MovieMenuOptions.GetMovieWithGenre:
                    //await GetMovieByIdWithGenreAsync();
                    GetMovieByIdWithGenreAsync().Wait();
                    break;

                case (int)MovieMenuOptions.GetMovieWithCast:
                    //await GetMovieByIdWithCastAsync();
                    GetMovieByIdWithCastAsync().Wait();
                    break;

                case (int)MovieMenuOptions.GetMovieWithUser:
                    //await GetMovieByIdWithUserAsync();
                    GetMovieByIdWithUserAsync().Wait();
                    break;

                case (int)MovieMenuOptions.Exit:
                    Console.WriteLine("Thanks for your visit. Please visit the Movie System again !!!!");
                    break;

                default:
                    Console.WriteLine("Invalid Option");
                    break;
                }

                if (choice != (int)MovieMenuOptions.Exit)
                {
                    Console.WriteLine("Press Enter to continue.......");
                    Console.ReadLine();
                    Console.Clear();
                }
            } while (choice != (int)MovieMenuOptions.Exit);
        }