public void AddOutingToListTest()
        {
            Outing outing = new Outing("Amusement Park", new DateTime(2019, 5, 25), 35);

            _outingsRepo.AddOutingToList(outing);

            int expected = 2;
            int actual   = _outingsRepo.GetListOfOutings().Count;

            Assert.AreEqual(expected, actual);
        }
Beispiel #2
0
        private void AddOutingToList()
        {
            Outing newOuting = new Outing();

            Console.Write("What type of outing would you like to add (Golf, Bowling, Amusement Park, or Concert)? ");
            newOuting.OutingTypeName = Console.ReadLine();
            Console.Write("What is the date of the outing? ");
            newOuting.EventDate = DateTime.Parse(Console.ReadLine());
            Console.Write("How many people will be attending? ");
            newOuting.NumberAttending = int.Parse(Console.ReadLine());
            Console.WriteLine($"This {newOuting.OutingTypeName} for {newOuting.NumberAttending} people on {newOuting.EventDate} will cost ${newOuting.CostPerPerson} per person for a total of {newOuting.TotalCost}\n" +
                              $"Press any key to continue...");
            _outingsRepo.AddOutingToList(newOuting);
            Console.ReadKey();
        }
Beispiel #3
0
        public void AddOutingToList()
        {
            Console.WriteLine("What type of outing is this?\n" +
                              "1. Golf\n" +
                              "2. Bowling\n" +
                              "3. Amusement Park\n" +
                              "4. Concert\n");
            string     typeOfOutingAsString = Console.ReadLine();
            int        typeOfOutingAsInt    = int.Parse(typeOfOutingAsString);
            OutingType typeOfOuting         = (OutingType)typeOfOutingAsInt;

            Console.WriteLine("How many people are attending this outing?");
            string numberOfAttendeesAsString = Console.ReadLine();
            int    numberOfAttendees         = int.Parse(numberOfAttendeesAsString);

            Console.WriteLine("Enter the date of the outing as DD/MM/YYYY: ");
            string   dateOfOutingAsString = Console.ReadLine();
            DateTime dateOfOuting         = DateTime.Parse(dateOfOutingAsString);

            Console.WriteLine("What is the cost per attendee?");
            string  totalCostPerAttendeeAsString = Console.ReadLine();
            decimal totalCostPerAttendee         = decimal.Parse(totalCostPerAttendeeAsString);

            Outings newOuting = new Outings(typeOfOuting, numberOfAttendees, dateOfOuting, totalCostPerAttendee);

            _repo.AddOutingToList(newOuting);
        }
        public void Arrange()
        {
            _repo = new OutingsRepository();
            DateTime date1 = new DateTime(2020, 5, 17);

            _outings = new Outings(OutingType.Golf, 76, date1, 22);
            _repo.AddOutingToList(_outings);
        }
        public void AddOutingToList_ShouldGetNotNull()
        {
            DateTime          date2      = new DateTime(2020, 6, 04);
            Outings           newOuting  = new Outings(OutingType.Bowling, 123, date2, 17.25);
            OutingsRepository repository = new OutingsRepository();

            repository.AddOutingToList(newOuting);
            Outings contentFromList = repository.GetOutingByTypeDate(OutingType.Bowling, date2);

            Assert.IsNotNull(contentFromList);
        }
        private void AddNewOuting()
        {
            OutingType newOutingType           = OutingType.Bowling; //default outing is bowling
            int        newOutingAttendeeNumber = 0;                  //default number of attendees is 0
            DateTime   newOutingDate           = DateTime.Now;       //default date is today
            Double     newCostPerPerson        = 0;                  //default cost per person is $0

            Console.Clear();
            bool eventTypeValid = false;

            while (!eventTypeValid)
            {
                Console.WriteLine("What type of event was the outing?\n" +
                                  "1. Golf\n" +
                                  "2. Bowling\n" +
                                  "3. Amusement Park\n" +
                                  "4. Concert\n" +
                                  "Please enter 1, 2, 3, or 4.");
                string typeInput = Console.ReadLine();
                switch (typeInput)
                {
                case "1":
                    newOutingType  = OutingType.Golf;
                    eventTypeValid = true;
                    break;

                case "2":
                    newOutingType  = OutingType.Bowling;
                    eventTypeValid = true;
                    break;

                case "3":
                    newOutingType  = OutingType.Amusement_Park;
                    eventTypeValid = true;
                    break;

                case "4":
                    newOutingType  = OutingType.Concert;
                    eventTypeValid = true;
                    break;

                default:
                    //get valid input number
                    Console.WriteLine("Please enter a valid number");
                    break;
                }
            }
            Console.WriteLine("\nHow many people attended the event?\n");
            newOutingAttendeeNumber = int.Parse(Console.ReadLine());
            Console.WriteLine("What was the year of the event?");
            int outingYr = int.Parse(Console.ReadLine());

            Console.WriteLine("What was the month of the event? Please enter a number.");
            int outingMonth = ValidMonth();

            Console.WriteLine("What day of the month was the event? Please enter a number.");
            int outingDay = ValidDay(outingMonth, outingYr);

            newOutingDate = new DateTime(outingYr, outingMonth, outingDay);
            Console.WriteLine("\nWhat was the cost of the outing per person?\n");
            newCostPerPerson = double.Parse(Console.ReadLine());
            string  strCostPerson = newCostPerPerson.ToString("n2");
            Outings newOuting     = new Outings(newOutingType, newOutingAttendeeNumber, newOutingDate, newCostPerPerson);

            _outingsRepo.AddOutingToList(newOuting);
            Console.WriteLine($"\nThe {newOutingType} outing on {outingMonth}-{outingDay}-{outingYr} was added.\n" +
                              $"A total of {newOutingAttendeeNumber} people attended this event at a cost of ${strCostPerson} per person.\n" +
                              $"The total cost for this event was ${newOuting.CostEvent}.");
        }
 public void Arrange()
 {
     _outingsRepo = new OutingsRepository();
     _outing      = new Outing("Golf", new DateTime(2019, 3, 17), 125);
     _outingsRepo.AddOutingToList(_outing);
 }