コード例 #1
0
        }//-end of ViewAllOutings()-

        // case 2
        private void CreateNewOuting()
        {
            Console.Clear();

            OutingsClass newEvent = new OutingsClass();

            // Outing Type
            Console.WriteLine("Enter the type of Event:");
            newEvent.OutingType = Console.ReadLine();
            // Number of People
            Console.WriteLine("How many people attended?:");
            string numPeopleAsString = Console.ReadLine();

            newEvent.NumPeopleAttended = int.Parse(numPeopleAsString);
            // Outing Date
            Console.WriteLine("Enter the date of the event (format example: 12-12-2000):");
            //DateTime date = new DateTime(2300, 12, 31);
            newEvent.OutingDate = DateTime.Parse(Console.ReadLine());  //
            // Total Person Cost
            Console.WriteLine("How much did it cost per person? Please do not use a dollar sign ($):");
            string numCostAsString = Console.ReadLine();

            newEvent.TotalPersonCost = double.Parse(numCostAsString);
            // Total Event Cost
            Console.WriteLine("How much did the event cost? Please do not use a dollar sign ($):");
            string numTotalCostAsString = Console.ReadLine();

            newEvent.TotalOutingCost = double.Parse(numTotalCostAsString);

            _eventRepo.AddOutingToList(newEvent);
        }//-end of CreateNewOuting()-
コード例 #2
0
        }//-end of ViewCost()-

        // Seeds
        private void SeedContentList()
        {
            OutingsClass golf          = new OutingsClass("Golf", 24, new DateTime(2020, 12, 12), 8.50, 304);
            OutingsClass bowling       = new OutingsClass("Bowling", 39, new DateTime(2020, 12, 12), 12, 668);
            OutingsClass amusementPark = new OutingsClass("Amusement Park", 11, new DateTime(2020, 12, 12), 22, 342);
            OutingsClass concert       = new OutingsClass("Concert", 20, new DateTime(2020, 12, 12), 30, 700);

            _eventRepo.AddOutingToList(golf);
            _eventRepo.AddOutingToList(bowling);
            _eventRepo.AddOutingToList(amusementPark);
            _eventRepo.AddOutingToList(concert);
        }
コード例 #3
0
        public void AddOutingToList_ShouldWork()
        {
            // Arrange
            OutingsRepo  testRepo = new OutingsRepo();
            OutingsClass newEvent = new OutingsClass {
                OutingType = "Sledding", NumPeopleAttended = 10, OutingDate = new DateTime(2020, 1, 10), TotalPersonCost = 25, TotalOutingCost = 350
            };
            List <OutingsClass> _listOfOutings = new List <OutingsClass>();

            // Act
            _listOfOutings.Add(newEvent);

            // Assert
            Assert.IsTrue(_listOfOutings.Count > 0);
        }
コード例 #4
0
        }//-end of CreateNewOuting()-

        // case 3
        private void ViewCost()
        {
            Console.Clear();

            Console.WriteLine("Enter the type of event you'd like to see:");

            string cost = Console.ReadLine();

            OutingsClass outing = _eventRepo.GetCostByType(cost);

            if (outing != null)
            {
                Console.WriteLine("All events in the " + outing.OutingType + " category cost: $" + outing.TotalOutingCost);
            }
            else
            {
                Console.WriteLine("Sorry, no event by that name was found.");
            }
        }//-end of ViewCost()-