示例#1
0
        public void DeleteExistingContent_ShouldReturnTrue()
        {
            //Arrange
            Bowling repo    = new Bowling();
            Bowling content = new Bowling();

            repo.AddContentToDirectory(content);

            //Act
            Bowling oldContent = repo.GetContentByTitle("Bowling");

            bool removeResult = repo.DeleteExistingContent(oldContent);

            //Assert
            Assert.IsNull(removeResult);
        }
示例#2
0
        private void DeleteContentByTitle()
        {
            ShowAllContent();



            bool continueToRun = true;

            while (continueToRun)
            {
                Console.Clear();

                Console.WriteLine("Enter the number of the option you'd like to select:\n" +
                                  "1. Find Bowling Events by name\n" +
                                  "2. Find Concert Events by name\n" +
                                  "3. Find Golf Events by name\n" +
                                  "4. Find Amusement Park Events by name\n" +
                                  "5. Exit");

                string input = Console.ReadLine();

                switch (input)
                {
                case "1":

                    Console.ReadKey();
                    Console.WriteLine("Enter the car's name for the car you would like to delete.");
                    string  titleToDeleteBowling   = Console.ReadLine();
                    Bowling contentToDeleteBowling = _bowlingRepo.GetContentByTitle(titleToDeleteBowling);
                    bool    wasDeletedBowling      = _bowlingRepo.DeleteExistingContent(contentToDeleteBowling);
                    if (wasDeletedBowling)
                    {
                        Console.WriteLine("This content was successfully deleted.");
                    }
                    else
                    {
                        Console.WriteLine("Content could not be deleted");
                    }

                    break;

                case "2":

                    Console.ReadKey();
                    Console.WriteLine("Enter the car's name for the car you would like to delete.");
                    string   titleToDeleteConcerts  = Console.ReadLine();
                    Concerts contentToDeleteConcert = _concertsRepo.GetContentByTitle(titleToDeleteConcerts);
                    bool     wasDeletedConcert      = _concertsRepo.DeleteExistingContent(contentToDeleteConcert);
                    if (wasDeletedConcert)
                    {
                        Console.WriteLine("This content was successfully deleted.");
                    }
                    else
                    {
                        Console.WriteLine("Content could not be deleted");
                    }

                    break;

                case "3":

                    Console.ReadKey();
                    Console.WriteLine("Enter the car's name for the car you would like to delete.");
                    string titleToDeleteGolf   = Console.ReadLine();
                    Golf   contentToDeleteGolf = _golfRepo.GetContentByTitle(titleToDeleteGolf);
                    bool   wasDeletedGolf      = _golfRepo.DeleteExistingContent(contentToDeleteGolf);
                    if (wasDeletedGolf)
                    {
                        Console.WriteLine("This content was successfully deleted.");
                    }
                    else
                    {
                        Console.WriteLine("Content could not be deleted");
                    }


                    break;

                case "4":

                    Console.ReadKey();
                    Console.WriteLine("Enter the car's name for the car you would like to delete.");
                    string         titleToDeleteAmusement   = Console.ReadLine();
                    AmusementParks contentToDeleteAmusement = _amusementRepo.GetContentByTitle(titleToDeleteAmusement);
                    bool           wasDeletedAmusement      = _amusementRepo.DeleteExistingContent(contentToDeleteAmusement);
                    if (wasDeletedAmusement)
                    {
                        Console.WriteLine("This content was successfully deleted.");
                    }
                    else
                    {
                        Console.WriteLine("Content could not be deleted");
                    }
                    break;

                case "5":

                    continueToRun = false;
                    break;

                default:
                    Console.WriteLine("Please choose a valid option");
                    Console.ReadKey();
                    break;
                }
            }
        }