예제 #1
0
        private void AddToOutings()
        {
            Outing        oneEvent = new Outing();
            List <Outing> outings  = new List <Outing>();

            Console.Clear();
            Console.Write("Is the event a Golf, Bowling, AmusementPark, or Concert event?:\n ");
            string type   = Console.ReadLine();
            int    enumID = Convert.ToInt32(type);

            oneEvent.EventType = (EventType)enumID;
            Console.Write("How many people will be attending?:\n");
            string att        = Console.ReadLine();
            int    attendance = Convert.ToInt32(att);

            oneEvent.Attendance = attendance;
            Console.Write("What is the date of the event? (ex. dd/mm/yyyy): \n");
            string   date     = Console.ReadLine();
            DateTime dateTime = Convert.ToDateTime(date);

            oneEvent.DateOfEvent = dateTime;
            Console.Write("What is the cost per person?: \n");
            string costPerson    = Console.ReadLine();
            double costPerPerson = Convert.ToDouble(costPerson);

            oneEvent.CostPerPerson = costPerPerson;
            Console.Write("What is the total cost of the event?: \n");
            string cost      = Console.ReadLine();
            double costEvent = Convert.ToDouble(cost);

            oneEvent.CostForEvent = costEvent;
            _repo.AddToList(oneEvent);
            Console.WriteLine("Press any key to continue");
            Console.ReadKey();
        }
예제 #2
0
        public void AddToListTest()
        {
            //Arrange
            Outing golfEvent = new Outing();
            //ACT
            bool hasAdded = _repo.AddToList(golfEvent);

            //Assert
            Assert.IsTrue(hasAdded);
        }
예제 #3
0
        public void AddOutingToList()
        {
            Console.WriteLine("Enter Outing Type: \n" +
                              "1. Golf\n" +
                              "2. Bowling\n" +
                              "3. Amusement Park\n" +
                              "4. Concert\n");
            string     typeAsString = Console.ReadLine();
            int        TypeAsInt    = int.Parse(typeAsString);
            OutingType type         = (OutingType)TypeAsInt;

            Console.WriteLine("Enter the Amount of People who Attended: ");
            string attendedAsString = Console.ReadLine();
            int    peopleAttended   = int.Parse(attendedAsString);

            Console.WriteLine("Enter Date of Outing: (Example: 9/1/2001) ");
            string   dateString = Console.ReadLine();
            DateTime date       = DateTime.Parse(dateString);

            Console.WriteLine("Enter Cost Per Person: ");
            string  costPerPersonString = Console.ReadLine();
            decimal costPerPerson       = decimal.Parse(costPerPersonString);

            //Console.WriteLine("Enter Cost of Event: ");
            //string costForEventString = Console.ReadLine();
            //decimal costForEvent = decimal.Parse(costForEventString);

            OutingContent content = new OutingContent(type, peopleAttended, date, costPerPerson);

            _outingRepo.AddToList(content);
        }
예제 #4
0
        public void CombineCostAllTest()
        {
            OutingRepo    outingRepo = new OutingRepo();
            OutingContent content    = new OutingContent();

            content.CostForEvent = 100m;

            OutingContent contentOne = new OutingContent();

            contentOne.CostForEvent = 100m;

            outingRepo.AddToList(content);
            outingRepo.AddToList(contentOne);
            decimal expected = 200m;

            decimal actual = outingRepo.CombinedCostOfAllOutingsGet();

            Assert.AreEqual(expected, actual);
        }
예제 #5
0
        public void CombinedCostAmusementParkTest()
        {
            OutingRepo    outingRepo = new OutingRepo();
            OutingContent content    = new OutingContent();

            content.CostForEvent = 100m;
            content.Type         = OutingType.AmusementPark;

            OutingContent contentOne = new OutingContent();

            contentOne.CostForEvent = 100m;
            contentOne.Type         = OutingType.AmusementPark;

            outingRepo.AddToList(content);
            outingRepo.AddToList(contentOne);
            decimal expected = 200m;
            decimal actual   = outingRepo.CombinedTypeCostAmusementParks();

            Assert.AreEqual(expected, actual);
        }
예제 #6
0
        public void AddToListTest()
        {
            OutingRepo           outingRepo = new OutingRepo();
            List <OutingContent> outingList = outingRepo.GetOutingList();

            OutingContent content = new OutingContent(OutingType.Concert, 10, DateTime.Today, 10m);

            int expected = 1;

            outingRepo.AddToList(content);

            Assert.AreEqual(expected, outingList.Count);
        }
예제 #7
0
        public void OutingRepo_AddToList_ShouldAddToList()
        {
            //--Arrange
            Outing outingList = new Outing();

            outingRepo.AddToList(outingList);
            List <Outing> menuListTest = outingRepo.GetList();
            //--Act
            int actual   = menuListTest.Count;
            int expected = 1;

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