コード例 #1
0
        private void Reporting()
        {
            Console.Clear();
            KomodoLogo();
            Console.ForegroundColor = ConsoleColor.DarkRed;
            Console.WriteLine("             Outing Reporting");
            Console.ResetColor();



            Console.ForegroundColor = ConsoleColor.White;
            decimal       totalOutingCost    = 0;
            decimal       totalGolfCost      = 0;
            decimal       totalAmusementCost = 0;
            decimal       totalBowlingCost   = 0;
            decimal       totalConcertCost   = 0;
            List <Outing> listOfOutings      = _repo.GetAllOutings();

            foreach (Outing outing in listOfOutings)         // Loop to calculate total costs of all events in the repo.
            {
                totalOutingCost += outing.CostOfEvent;
                if (outing.Type == EventType.AmusementPark)
                {
                    totalAmusementCost += outing.CostOfEvent;
                }
                else if (outing.Type == EventType.Golf)
                {
                    totalGolfCost += outing.CostOfEvent;
                }
                else if (outing.Type == EventType.Concert)
                {
                    totalConcertCost += outing.CostOfEvent;
                }
                else if (outing.Type == EventType.Bowling)
                {
                    totalBowlingCost += outing.CostOfEvent;
                }
            }
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("Total Spending on Outings:                 $" + totalOutingCost);
            Console.WriteLine("Total Spending on Golf Outings:            $" + totalGolfCost);
            Console.WriteLine("Total Spending on Amusement Park Outings:  $" + totalAmusementCost);
            Console.WriteLine("Total Spending on Concert Outings:         $" + totalConcertCost);
            Console.WriteLine("Total Spending on Bowling Outings:         $" + totalBowlingCost);



            Console.ResetColor();
            Console.WriteLine("Press any key to continue.");
            Console.ReadKey();
        }
コード例 #2
0
        public void GetOutings_ShouldReturnCorrectCollection() //Read
        {
            //Arrange
            Outing      outing = new Outing();
            Outing_Repo repo   = new Outing_Repo();

            repo.AddOuting(outing);

            //Act
            List <Outing> outings = repo.GetAllOutings();

            bool repoHasOutings = outings.Contains(outing);

            //Assert
            Assert.IsTrue(repoHasOutings);
        }