예제 #1
0
        private void AddNewOuting()
        {
            OutingInfo outing = new OutingInfo();

            Console.WriteLine("What type of outing would you like to add?\n" +
                              "1.Golf outting?\n" +
                              "2.Bowling\n" +
                              "3.Amusement Park\n" +
                              "4.Concert");
            int eventTypeEnum = int.Parse(Console.ReadLine());

            outing.EventType = (EventType)eventTypeEnum;

            Console.WriteLine("What was the date of the event?(01/01/2019)");
            outing.Date = DateTime.Parse(Console.ReadLine());

            Console.WriteLine("How many people attended?");
            outing.NumberOfPeopleAttended = int.Parse(Console.ReadLine());

            Console.WriteLine("What is the total cost breakdown per person? (must be a decimal)");
            outing.TotalCostPerPersonForEvent = decimal.Parse(Console.ReadLine());

            outing.TotalCostForTheEvent = outing.TotalCostPerPersonForEvent * outing.NumberOfPeopleAttended;

            outingrepo.AddTolist(outing);
        }
예제 #2
0
        public void GetTotalCostByType_ShouldReturnCorrectSum()
        {
            OutingRepository outingrepo = new OutingRepository();


            OutingInfo outing5 = new OutingInfo(EventType.Golf, 34, DateTime.Now, 90.09m, 1043.04m);

            outingrepo.AddTolist(outing5);

            decimal expected = 35463.36m;
            decimal actual   = outingrepo.GetTotalCostOfEventsWithType(EventType.Golf);


            Assert.AreEqual(expected, actual);
        }
예제 #3
0
        public void CreateNewOuting_AddToOutings_CountShouldBeTheSame()
        {
            OutingRepository outingrepo = new OutingRepository();

            List <OutingInfo> outing = outingrepo.SeeAllOutings();

            OutingInfo outing5 = new OutingInfo(EventType.Golf, 34, DateTime.Now, 90.09m, 104144.04m);

            outingrepo.AddTolist(outing5);

            int expected = 1;
            int actual   = outing.Count;

            Assert.AreEqual(expected, actual);
        }
예제 #4
0
        public void AddCostShouldReturnCorrectValue()
        {
            OutingRepo _outingRepo = new OutingRepo();
            OutingInfo outing      = new OutingInfo(OutingType.Golf, 10, "03/01/18", 20.00m, 200.00m);
            OutingInfo outingTwo   = new OutingInfo(OutingType.Golf, 10, "03/01/18", 20.00m, 200.00m);
            OutingInfo outingThree = new OutingInfo(OutingType.Golf, 10, "03/01/18", 20.00m, 200.00m);

            _outingRepo.AddOutingToList(outing);
            _outingRepo.AddOutingToList(outingTwo);
            _outingRepo.AddOutingToList(outingThree);

            decimal actual   = _outingRepo.AddCostofOneType(OutingType.Golf);
            decimal expected = 600m;

            Assert.AreEqual(expected, actual);
        }
예제 #5
0
        public void AddOutingsShouldReturnCorrectCount()
        {   //Arrange
            OutingRepo _outingRepo = new OutingRepo();
            OutingInfo outing      = new OutingInfo();
            OutingInfo outingTwo   = new OutingInfo();
            OutingInfo outingThree = new OutingInfo();

            _outingRepo.AddOutingToList(outing);
            _outingRepo.AddOutingToList(outingTwo);
            _outingRepo.AddOutingToList(outingThree);
            //Act
            int actual   = _outingRepo.GetOutingInfo().Count;
            int expected = 3;

            //Assert
            Assert.AreEqual(expected, actual);
        }