Beispiel #1
0
        public void GetByTitle_ShouldReturnCorrectContent()
        {
            //Arrange
            Bowling repo       = new Bowling();
            Bowling newContent = new Bowling();

            repo.AddContentToDirectory(newContent);
            string title = "";

            //Act
            Bowling searchResult = repo.GetContentByTitle(title);

            //Assert
            Assert.AreEqual(searchResult.NameOfEvent, title);
        }
Beispiel #2
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);
        }
Beispiel #3
0
        private void ShowContentByTitle()
        {
            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.Clear();

                    Console.WriteLine("Enter the title of the content you'd like to see.");
                    string titleBowling = Console.ReadLine();

                    Bowling contentBowling = _bowlingRepo.GetContentByTitle(titleBowling);

                    if (contentBowling != null)
                    {
                        DisplayContent(contentBowling);
                    }
                    else
                    {
                        Console.WriteLine("That title doesn't exist.");
                    }
                    Console.ReadKey();

                    break;

                case "2":

                    Console.Clear();

                    Console.WriteLine("Enter the title of the content you'd like to see.");
                    string titleConcerts = Console.ReadLine();

                    Concerts contentConcerts = _concertsRepo.GetContentByTitle(titleConcerts);

                    if (contentConcerts != null)
                    {
                        DisplayContent(contentConcerts);
                    }
                    else
                    {
                        Console.WriteLine("That title doesn't exist.");
                    }
                    Console.ReadKey();

                    break;

                case "3":

                    Console.Clear();

                    Console.WriteLine("Enter the title of the content you'd like to see.");
                    string titleGolf = Console.ReadLine();

                    Golf contentGolf = _golfRepo.GetContentByTitle(titleGolf);

                    if (contentGolf != null)
                    {
                        DisplayContent(contentGolf);
                    }
                    else
                    {
                        Console.WriteLine("That title doesn't exist.");
                    }
                    Console.ReadKey();

                    break;

                case "4":

                    Console.Clear();

                    Console.WriteLine("Enter the title of the content you'd like to see.");
                    string titleAmusement = Console.ReadLine();

                    AmusementParks contentAmusement = _amusementRepo.GetContentByTitle(titleAmusement);

                    if (contentAmusement != null)
                    {
                        DisplayContent(contentAmusement);
                    }
                    else
                    {
                        Console.WriteLine("That title doesn't exist.");
                    }
                    Console.ReadKey();

                    break;

                case "5":

                    continueToRun = false;
                    break;

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