Exemplo n.º 1
0
        public void AddToDirectory_ShouldGetCorrectBoolean()
        {
            //Arrange
            Bowling content    = new Bowling();
            Bowling repository = new Bowling();

            //Act
            bool addResult = repository.AddContentToDirectory(content);

            //Assert
            Assert.IsTrue(addResult);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
        public void UpdateExistingContent_ShouldReturnTrue()
        {
            //Arrange
            Bowling repo       = new Bowling();
            Bowling oldContent = new Bowling();

            repo.AddContentToDirectory(oldContent);

            Bowling newContent = new Bowling();

            //Act
            bool updateResult = repo.UpdateExistingContent(oldContent.NameOfEvent, newContent);

            //Assert
            Assert.IsTrue(updateResult);
        }
Exemplo n.º 5
0
        public void GetDirectory_ShouldReturnCorrectCollection()
        {
            //Arrange
            Bowling content = new Bowling();
            Bowling repo    = new Bowling();

            repo.AddContentToDirectory(content);

            //Act
            List <Bowling> contents = repo.GetContents();

            bool directoryHasContent = contents.Contains(content);

            //Assert
            Assert.IsTrue(directoryHasContent);
        }
Exemplo n.º 6
0
        private void CreateNewContent()
        {
            bool continueToRun = true;

            while (continueToRun)
            {
                Console.Clear();

                Console.WriteLine("Enter the number of the option you'd like to select:\n" +
                                  "1. Create new Bowling Event\n" +
                                  "2. Create new Concert Event\n" +
                                  "3. Create new Golf Event\n" +
                                  "4. Create new Amusement Park Event\n" +
                                  "5. Exit");
                string input = Console.ReadLine();

                switch (input)
                {
                case "1":

                    Console.Clear();

                    Bowling newContentBowling = new Bowling();

                    Console.WriteLine("Please enter a name for this event.");
                    string nameBowlingAsString = Console.ReadLine();
                    newContentBowling.NameOfEvent = nameBowlingAsString;

                    Console.WriteLine("Please enter the number of people attending the event.");
                    string numberOfPeopleAsString = Console.ReadLine();
                    int    numberOfPeopleAsInt    = int.Parse(numberOfPeopleAsString);
                    newContentBowling.NumberOfPeople = numberOfPeopleAsInt;

                    Console.WriteLine("Please enter a cost per person for this event.");
                    string costPerPersonAsString = Console.ReadLine();
                    double costPerPersonAsInt    = double.Parse(costPerPersonAsString);
                    newContentBowling.CostPerPerson = costPerPersonAsInt;

                    Console.WriteLine("Please enter a total cost for the entire event.");
                    string costOfEntireEventAsString = Console.ReadLine();
                    double costOfEntireEventAsDouble = int.Parse(costOfEntireEventAsString);
                    newContentBowling.CostOfEntireEvent = costOfEntireEventAsDouble;

                    Console.WriteLine("Please enter a date for this event.");
                    string   dateAsString = Console.ReadLine();
                    DateTime dateAsDate   = DateTime.Parse(dateAsString);
                    newContentBowling.Date = dateAsDate;

                    bool wasAddedRepo = _bowlingRepo.AddContentToDirectory(newContentBowling);

                    if (wasAddedRepo == true)
                    {
                        Console.WriteLine("Your content was succesfully added.");
                    }
                    else
                    {
                        Console.WriteLine("Oops something went wrong. Your content was not added.");
                    }

                    break;

                case "2":
                    Console.Clear();

                    Concerts newContentConcerts = new Concerts();

                    Console.WriteLine("Please enter a name for this event.");
                    string nameConcertAsString = Console.ReadLine();
                    newContentConcerts.NameOfEvent = nameConcertAsString;

                    Console.WriteLine("Please enter the number of people attending the event.");
                    string numberOfPeopleConcertsAsString = Console.ReadLine();
                    int    numberOfPeopleConcertsAsInt    = int.Parse(numberOfPeopleConcertsAsString);
                    newContentConcerts.NumberOfPeople = numberOfPeopleConcertsAsInt;

                    Console.WriteLine("Please enter a cost per person for this event.");
                    string costPerPersonConcertsAsString = Console.ReadLine();
                    double costPerPersonConcertsAsInt    = double.Parse(costPerPersonConcertsAsString);
                    newContentConcerts.CostPerPerson = costPerPersonConcertsAsInt;

                    Console.WriteLine("Please enter a total cost for the entire event.");
                    string costOfEntireEventConcertsAsString = Console.ReadLine();
                    double costOfEntireEventConcertsAsDouble = int.Parse(costOfEntireEventConcertsAsString);
                    newContentConcerts.CostOfEntireEvent = costOfEntireEventConcertsAsDouble;

                    Console.WriteLine("Please enter a date for this event.");
                    string   dateConcertsAsString = Console.ReadLine();
                    DateTime dateConcertsAsDate   = DateTime.Parse(dateConcertsAsString);
                    newContentConcerts.Date = dateConcertsAsDate;

                    bool wasAddedRepoConcerts = _concertsRepo.AddContentToDirectory(newContentConcerts);

                    if (wasAddedRepoConcerts == true)
                    {
                        Console.WriteLine("Your content was succesfully added.");
                    }
                    else
                    {
                        Console.WriteLine("Oops something went wrong. Your content was not added.");
                    }
                    break;

                case "3":

                    Console.Clear();

                    Golf newContentGolf = new Golf();

                    Console.WriteLine("Please enter a name for this event.");
                    string nameGolfAsString = Console.ReadLine();
                    newContentGolf.NameOfEvent = nameGolfAsString;

                    Console.WriteLine("Please enter the number of people attending the event.");
                    string numberOfPeopleGolfAsString = Console.ReadLine();
                    int    numberOfPeopleGolfAsInt    = int.Parse(numberOfPeopleGolfAsString);
                    newContentGolf.NumberOfPeople = numberOfPeopleGolfAsInt;

                    Console.WriteLine("Please enter a cost per person for this event.");
                    string costPerPersonGolfAsString = Console.ReadLine();
                    double costPerPersonGolfAsInt    = double.Parse(costPerPersonGolfAsString);
                    newContentGolf.CostPerPerson = costPerPersonGolfAsInt;

                    Console.WriteLine("Please enter a total cost for the entire event.");
                    string costOfEntireEventGolfAsString = Console.ReadLine();
                    double costOfEntireEventGolfAsDouble = int.Parse(costOfEntireEventGolfAsString);
                    newContentGolf.CostOfEntireEvent = costOfEntireEventGolfAsDouble;

                    Console.WriteLine("Please enter a date for this event.");
                    string   dateGolfAsString = Console.ReadLine();
                    DateTime dateGolfAsDate   = DateTime.Parse(dateGolfAsString);
                    newContentGolf.Date = dateGolfAsDate;

                    bool wasAddedRepoGolf = _golfRepo.AddContentToDirectory(newContentGolf);

                    if (wasAddedRepoGolf == true)
                    {
                        Console.WriteLine("Your content was succesfully added.");
                    }
                    else
                    {
                        Console.WriteLine("Oops something went wrong. Your content was not added.");
                    }

                    break;

                case "4":

                    Console.Clear();

                    AmusementParks newContentAmusement = new AmusementParks();

                    Console.WriteLine("Please enter a name for this event.");
                    string nameAmusementAsString = Console.ReadLine();
                    newContentAmusement.NameOfEvent = nameAmusementAsString;

                    Console.WriteLine("Please enter the number of people attending the event.");
                    string numberOfPeopleAmusementAsString = Console.ReadLine();
                    int    numberOfPeopleAmusementAsInt    = int.Parse(numberOfPeopleAmusementAsString);
                    newContentAmusement.NumberOfPeople = numberOfPeopleAmusementAsInt;

                    Console.WriteLine("Please enter a cost per person for this event.");
                    string costPerPersonAmusementAsString = Console.ReadLine();
                    double costPerPersonAmusementAsInt    = double.Parse(costPerPersonAmusementAsString);
                    newContentAmusement.CostPerPerson = costPerPersonAmusementAsInt;

                    Console.WriteLine("Please enter a total cost for the entire event.");
                    string costOfEntireEventAmusementAsString = Console.ReadLine();
                    double costOfEntireEventAmusementAsDouble = int.Parse(costOfEntireEventAmusementAsString);
                    newContentAmusement.CostOfEntireEvent = costOfEntireEventAmusementAsDouble;

                    Console.WriteLine("Please enter a date for this event.");
                    string   dateAmusementAsString = Console.ReadLine();
                    DateTime dateAmusementAsDate   = DateTime.Parse(dateAmusementAsString);
                    newContentAmusement.Date = dateAmusementAsDate;

                    bool wasAddedRepoAmusement = _amusementRepo.AddContentToDirectory(newContentAmusement);

                    if (wasAddedRepoAmusement == true)
                    {
                        Console.WriteLine("Your content was succesfully added.");
                    }
                    else
                    {
                        Console.WriteLine("Oops something went wrong. Your content was not added.");
                    }

                    break;

                case "5":

                    continueToRun = false;
                    break;

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