Ejemplo n.º 1
0
        public void OutingRepository_CombineOutingByType_ShouldReturnTotalCostByType()
        {
            //-- Assert
            OutingRepository outingRepo = new OutingRepository();

            DateTime renOneDate  = new DateTime(2016, 10, 15);
            DateTime renTwoDate  = new DateTime(2016, 11, 15);
            DateTime concertDate = new DateTime(2017, 04, 03);

            Outing RenOne  = new Outing("Renaissance Festival", 15, renOneDate, 15m);
            Outing RenTwo  = new Outing("Renaissance Festival", 20, renTwoDate, 15m);
            Outing Concert = new Outing("Concert", 10, concertDate, 65m);

            outingRepo.AddOuting(RenOne);
            outingRepo.AddOuting(RenTwo);
            outingRepo.AddOuting(Concert);

            decimal totalbyType = outingRepo.CombineOutingByType("Renaissance Festival");

            //-- Act
            decimal actual   = outingRepo.CombineOutingByType("Renaissance Festival");
            decimal expected = 525m;

            //-- Assert
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 2
0
        private void SeedOutingList()
        {
            OutingContent outingOne   = new OutingContent(EventType.Bowling, 20, new DateTime(2020, 8, 8), 20.00m);
            OutingContent outingTwo   = new OutingContent(EventType.AmusementPark, 50, new DateTime(2020, 10, 1), 50.00m);
            OutingContent outingThree = new OutingContent(EventType.Concert, 30, new DateTime(2020, 7, 15), 30.00m);

            outingTest.AddOuting(outingOne);
            outingTest.AddOuting(outingTwo);
            outingTest.AddOuting(outingThree);
        }
Ejemplo n.º 3
0
        public void SeedContentToList()
        {
            Outing outingOne   = new Outing(EventType.AmusementPark, 15, DateTime.Parse("05/18/2019"), 35);
            Outing outingTwo   = new Outing(EventType.Golf, 13, DateTime.Parse("03/02/2019"), 25);
            Outing outingThree = new Outing(EventType.Bowling, 10, DateTime.Parse("07/27/2019"), 15);

            _outingRepo.AddOuting(outingOne);
            _outingRepo.AddOuting(outingTwo);
            _outingRepo.AddOuting(outingThree);
        }
Ejemplo n.º 4
0
        public void AddOutingShouldReturnValue()
        {
            List <Outing> testList = _outingRepo.GetList();

            _outingRepo.AddOuting(Outing.EventType.AmusementPark, 10, DateTime.Today, 5m, 100m);

            var actual   = _outingRepo.GetList().Count;
            var expected = 1;

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 5
0
        public void Arrange()
        {
            _outingRepo  = new OutingRepository();
            _outingOne   = new Outing(EventType.Golf, 4, DateTime.Parse("03/12/2019"), 15);
            _outingTwo   = new Outing(EventType.Golf, 7, DateTime.Parse("07/23/2019"), 10);
            _outingThree = new Outing(EventType.Bowling, 9, DateTime.Parse("11/05/2018"), 13);

            _outingRepo.AddOuting(_outingOne);
            _outingRepo.AddOuting(_outingTwo);
            _outingRepo.AddOuting(_outingThree);
        }
Ejemplo n.º 6
0
        public void OutingRepository_GetCostByType_ShouldReturnTypeTotalCost()
        {
            OutingRepository outingRepo = new OutingRepository();
            List <Outing>    testList   = outingRepo.GetList();

            outingRepo.AddOuting(EventType.AmusementPark, 5, DateTime.Today, 5m, 150m);
            outingRepo.AddOuting(EventType.Bowling, 5, DateTime.Today, 5m, 30m);

            var expected = 150m;
            var actual   = outingRepo.GetCostByType(EventType.AmusementPark);

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 7
0
        public void OutingRepository_TotalCost_ShouldReturnTotal()
        {
            OutingRepository outingRepo = new OutingRepository();
            List <Outing>    testList   = outingRepo.GetList();

            outingRepo.AddOuting(EventType.AmusementPark, 5, DateTime.Today, 5m, 20m);
            outingRepo.AddOuting(EventType.AmusementPark, 5, DateTime.Today, 5m, 20m);

            var expected = 40m;
            var actual   = outingRepo.TotalCost();

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 8
0
        public void OutingRepository_TotalCost_ShouldReturnCorrecCost()
        {
            //Arrange
            OutingRepository outingRepo = new OutingRepository();
            List <Outing>    testList   = outingRepo.GetList();

            //Act
            outingRepo.AddOuting(EventType.Golf, 5, DateTime.Today, 5m, 20m);
            outingRepo.AddOuting(EventType.Golf, 5, DateTime.Today, 5m, 20m);
            var expected = 40m;
            var actual   = outingRepo.TotalCost();

            //Assert
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 9
0
        public void GetTotalByTypeTest()
        {
            OutingRepository oRepo   = new OutingRepository();
            List <Outing>    outings = new List <Outing>();

            Outing test  = new Outing(OutingType.Bowling, 50, new DateTime(), 15, 1500);
            Outing test2 = new Outing(OutingType.Golf, 50, new DateTime(), 15, 1500);

            oRepo.AddOuting(test);
            oRepo.AddOuting(test2);

            double expected = 1500;
            double actual   = oRepo.GetTotalByType(OutingType.Golf);

            Assert.AreEqual(expected, actual);
        }
        public void AddOuting_ShouldReturnCorrectBool()
        {
            Outing           outing     = new Outing();
            OutingRepository outingRepo = new OutingRepository();

            bool outingAdded = outingRepo.AddOuting(outing);

            Assert.IsTrue(outingAdded);
        }
Ejemplo n.º 11
0
        public void OutingRepository_AddOuting_ShouldIncreaseCountByOne()
        {
            //--Arrange
            DateTime renOneDate = new DateTime(2016, 10, 15);
            DateTime renTwoDate = new DateTime(2016, 11, 15);

            Outing RenOne = new Outing("Renaissance Festival", 15, renOneDate, 15m);
            Outing RenTwo = new Outing("Renaissance Festival", 20, renTwoDate, 15m);

            outingRepo.AddOuting(RenOne);
            outingRepo.AddOuting(RenTwo);

            //--Act
            int actual   = outingRepo.CountOutings();
            int expected = 2;

            //--Assert
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 12
0
        public void Arrange()
        {
            _outingRepo = new OutingRepository();

            DateTime dt1 = new DateTime(2019, 4, 2);

            _outing1 = new Outing(dt1, EventType.Bowling, 9, 430.14);
            _outingRepo.AddOuting(_outing1);
            DateTime dt2 = new DateTime(2019, 5, 1);

            _outing2 = new Outing(dt2, EventType.Golf, 4, 559.81);
            _outingRepo.AddOuting(_outing2);
            DateTime dt3 = new DateTime(2019, 5, 14);

            _outing3 = new Outing(dt3, EventType.AmusementPark, 8, 947.32);
            _outingRepo.AddOuting(_outing3);

            _outing4 = new Outing(DateTime.Now, EventType.Golf, 3, 810.02);
            _outingRepo.AddOuting(_outing4);
        }
Ejemplo n.º 13
0
        public void AddOutingTest()
        {
            OutingRepository oRepo   = new OutingRepository();
            List <Outing>    outings = oRepo.GetOutings();

            Outing test = new Outing(OutingType.Bowling, 50, new DateTime(), 15, 1500);

            oRepo.AddOuting(test);

            Assert.IsTrue(outings.Contains(test));
        }
        private void AddOuting()
        {
            Console.Clear();
            var outing = new Outing();

            //Type of Event
            Console.WriteLine("Select an Event Type: \n" +
                              "1.) Golf\n" +
                              "2.) Bowling\n" +
                              "3.) Amusement Park\n" +
                              "4.) Concert");
            string outingTypeString = Console.ReadLine();

            switch (outingTypeString)
            {
            case "1":
                outing.TypeOfEvent = EventType.Golf;
                break;

            case "2":
                outing.TypeOfEvent = EventType.Bowling;
                break;

            case "3":
                outing.TypeOfEvent = EventType.AmusementPark;
                break;

            case "4":
                outing.TypeOfEvent = EventType.Concert;
                break;
            }

            Console.WriteLine("Please enter the number of people that attended the event:");
            outing.NumOfPeopleAttended = int.Parse(Console.ReadLine());
            Console.WriteLine("Please enter the date of the event: (DD-MM-YYYY)");
            outing.Date = Console.ReadLine();
            Console.WriteLine("Please enter the cost per person:");
            outing.CostPerPerson = double.Parse(Console.ReadLine());

            _outingRepo.AddOuting(outing);
        }
Ejemplo n.º 15
0
        public void AddOuting_ShouldReturnTrue()
        {
            //Arrange
            OutingRepository outingRepo = new OutingRepository();
            Outing           outing     = new Outing();

            //Act
            bool addSucceeded = outingRepo.AddOuting(outing);

            //Assert
            Assert.IsTrue(addSucceeded);
        }
        public void GetAllOutings_ShouldReturnCorrectList()
        {
            Outing           outing     = new Outing();
            OutingRepository outingRepo = new OutingRepository();

            outingRepo.AddOuting(outing);

            List <Outing> outings = outingRepo.GetAllOutings();
            bool          directoryContainsOuting = outings.Contains(outing);

            Assert.IsTrue(directoryContainsOuting);
        }
Ejemplo n.º 17
0
        public void OutingRepo_AddOuting_AddItemToList()
        {
            //-- Arrange
            Outing event1 = new Outing();
            Outing event2 = new Outing();
            Outing event3 = new Outing();

            OutingRepository repo = new OutingRepository();

            repo.AddOuting(event1); // Tested method
            repo.AddOuting(event2);
            repo.AddOuting(event3);

            var list = repo.GetOutings();

            //-- Act
            int actual   = list.Count;
            int expected = 3;

            //-- Assert
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 18
0
        public void OutingRepo_CostAllOutings_ShouldReturnTotalCostOfAllOutings()
        {
            //-- Arrange
            Outing event1 = new Outing("Bowling", 4, DateTime.Now, 19.99m, 19.99m * 4); // 79.96
            Outing event2 = new Outing("Golf", 2, DateTime.Now, 39.99m, 39.99m * 2);    //79.98
            Outing event3 = new Outing("Concert", 6, DateTime.Now, 49.99m, 49.99m * 6); // 299.94

            OutingRepository repo = new OutingRepository();

            repo.AddOuting(event1);
            repo.AddOuting(event2);
            repo.AddOuting(event3);

            var outingList = repo.GetOutings();

            //-- Act
            decimal actual   = repo.CostAllOutings(outingList); // Tested method
            decimal expected = event1.CostofEvent + event2.CostofEvent + event3.CostofEvent;

            //-- Assert
            Assert.AreEqual(expected, actual);
        }
        public void Arrange()
        {
            GolfOuting golfOuting1 = new GolfOuting();

            golfOuting1.TotalCost = 500m;
            _outings.AddOuting(golfOuting1);

            GolfOuting golfOuting2 = new GolfOuting();

            golfOuting2.TotalCost = 250m;
            _outings.AddOuting(golfOuting2);

            ConcertOuting concertOuting1 = new ConcertOuting();

            concertOuting1.TotalCost = 200m;
            _outings.AddOuting(concertOuting1);

            ConcertOuting concertOuting2 = new ConcertOuting();

            concertOuting2.TotalCost = 400m;
            _outings.AddOuting(concertOuting2);

            AmusementParkOuting amusement1 = new AmusementParkOuting();

            amusement1.TotalCost = 1000m;
            _outings.AddOuting(amusement1);

            AmusementParkOuting amusement2 = new AmusementParkOuting();

            amusement2.TotalCost = 2000m;
            _outings.AddOuting(amusement2);

            BowlingOuting bowling1 = new BowlingOuting();

            bowling1.TotalCost = 100m;
            _outings.AddOuting(bowling1);

            BowlingOuting bowling2 = new BowlingOuting();

            bowling2.TotalCost = 300m;
            _outings.AddOuting(bowling2);
        }
Ejemplo n.º 20
0
        public void CreateOuting()
        {
            BeginSubmenu("CREATE A NEW OUTING");
            Outing userOuting = new Outing();

            Console.WriteLine("Please enter the outing date (mm/dd/yyyy):");
            string dateInput = Console.ReadLine();

            string[] arrayOfDateInput = dateInput.Split('/');
            int      month            = int.Parse(arrayOfDateInput[0]);
            int      day  = int.Parse(arrayOfDateInput[1]);
            int      year = int.Parse(arrayOfDateInput[2]);

            userOuting.Date = new DateTime(year, month, day);
            Console.WriteLine(" ");
            Console.WriteLine("Choose the event type:\n" +
                              "1:  Golf\n" +
                              "2:  Bowling\n" +
                              "3: Amusement Park\n" +
                              "4: Concert\n");
            string eventTypeInput = Console.ReadLine();

            switch (eventTypeInput)
            {
            case "1":
                userOuting.EventType = EventType.Golf;
                break;

            case "2":
                userOuting.EventType = EventType.Bowling;
                break;

            case "3":
                userOuting.EventType = EventType.AmusementPark;
                break;

            case "4":
                userOuting.EventType = EventType.Concert;
                break;

            default:
                Console.WriteLine("Make a selection between 1 and 4.");
                Console.ReadKey();
                break;
            }
            Console.WriteLine(" ");
            Console.WriteLine("How many people attended the outing?");
            int attendanceInput = int.Parse(Console.ReadLine());

            userOuting.Attendance = attendanceInput;
            Console.WriteLine(" ");
            Console.WriteLine("What was the total cost of the outing? Do not include a dollar sign.");
            double totalCostInput = int.Parse(Console.ReadLine());

            userOuting.TotalCost = totalCostInput;

            _outingRepo.AddOuting(userOuting);
            Console.WriteLine(" ");
            Console.WriteLine("The new outing has been added to the directory!");
            EndSubmenu();
        }
Ejemplo n.º 21
0
        public void AddOuting()
        {
            Outing outing1 = new Outing(Outing.Type.amusementPark, DateTime.Parse("09/26/2020"), 30, 7.50m);

            content.AddOuting(outing1);
        }
Ejemplo n.º 22
0
        private void AddOuting()
        {
            Console.Clear();
            OutingContent newOuting = new OutingContent();

            Console.WriteLine("What is the type of the event: Golf, Bowling, Amusement Park, Concert");
            string choice = Console.ReadLine();


            if (choice.ToLower() == "golf")
            {
                EventType eventType = EventType.Golf;
            }

            else if (choice.ToLower() == "bowling")
            {
                EventType eventType = EventType.Bowling;
            }

            else if (choice.ToLower() == "amusement park")
            {
                EventType eventType = EventType.AmusementPark;
            }

            else if (choice.ToLower() == "concert")
            {
                EventType eventType = EventType.Concert;
            }

            else
            {
                Console.WriteLine("Please enter Golf, Bowling, Amusement Park, or Concert \n" +
                                  "\n" +
                                  "Press any key to continue");
                Console.ReadKey();
                AddOuting();
            }

            Console.WriteLine("How many people attended? (numbers only please)");
            string attendees = Console.ReadLine();

            newOuting.AttendeeCount = int.Parse(attendees);

            Console.WriteLine("What was the date of the event? (mm/dd/yyyy)");
            string date = Console.ReadLine();

            newOuting.EventDate = DateTime.Parse(date);

            Console.WriteLine("What was the cost per person?");
            Console.Write("$ ");
            string cost = Console.ReadLine();

            newOuting.CostPerPerson = decimal.Parse(cost);

            _outingRepo.AddOuting(newOuting);

            Console.WriteLine("\n" +
                              "Outing Added \n" +
                              "\n" +
                              "Press any key to return to main menu");
            Console.ReadKey();
            Menu();
        }
Ejemplo n.º 23
0
        public void OutingRepository_AddOuting_Test()
        {
            outings.AddOuting(outing1);

            Assert.AreEqual(outing1, outings.outings[1]);
        }
        private void AddAnOuting()
        {
            DateTime date           = _prompt.PromptUserForDate();
            int      numberAttended = _prompt.PromptUserForNumberAttended();
            decimal  costPerPerson  = _prompt.PromptUserForCostPerPerson();
            decimal  totalCost      = _prompt.PromptUserForTotalCost();

            ConsoleKeyInfo userInput = _prompt.PromptUserForTypeOfOuting();

            switch (userInput.Key)
            {
            case ConsoleKey.D1:
            case ConsoleKey.NumPad1:
                _outings.AddOuting(new GolfOuting(date, numberAttended, costPerPerson, totalCost));
                break;

            case ConsoleKey.D2:
            case ConsoleKey.NumPad2:
                _outings.AddOuting(new AmusementParkOuting(date, numberAttended, costPerPerson, totalCost));
                break;

            case ConsoleKey.D3:
            case ConsoleKey.NumPad3:
                _outings.AddOuting(new ConcertOuting(date, numberAttended, costPerPerson, totalCost));
                break;

            case ConsoleKey.D4:
            case ConsoleKey.NumPad4:
                _outings.AddOuting(new BowlingOuting(date, numberAttended, costPerPerson, totalCost));
                break;

            default:
                break;
            }
            Console.Clear();
            Console.WriteLine("The outing was successfully added!\n" +
                              "Press enter to return to menu...");
            Console.ReadLine();
        }