public void CostAllEvent_Test()
        {
            Outing     outing      = new Outing(Event.Golf, 2, DateTime.Now, 10, 200);
            Outing     outingTwo   = new Outing(Event.Golf, 3, DateTime.Now, 15, 600);
            Outing     outingThree = new Outing(Event.Concert, 10, DateTime.Now, 20, 2000);
            OutingRepo repo        = new OutingRepo();

            repo.AddOuting(outing);
            repo.AddOuting(outingTwo);
            repo.AddOuting(outingThree);
            decimal amount   = repo.CostEvent();
            decimal actual   = amount;
            decimal expected = 2800;

            Assert.AreEqual(actual, expected);
        }
        public void CombinedCostTest_ShowsCombinedCostAndIndividualCosts()
        {
            OutingRepo repo   = new OutingRepo();
            Outing     outing = new Outing(events, peopleAttended, date, costPerPerson);


            repo.AddOuting(outing);
            Assert.IsTrue(repo.CombinedCosts());
        }
        public void AddOutingAndDisplayTest_AddsOutingAndDisplays()
        {
            OutingRepo repo   = new OutingRepo();
            Outing     outing = new Outing(events, peopleAttended, date, costPerPerson);


            repo.AddOuting(outing);
            Assert.IsTrue(repo.DisplayAll());
        }
        public void AddGetList_Test()
        {
            //Arrange
            Outing     outing      = new Outing();
            Outing     outingTwo   = new Outing(Event.Concert, 10, DateTime.Now, 20, 2000);
            Outing     outingThree = new Outing(Event.Golf, 2, DateTime.Now, 10, 200);
            OutingRepo repo        = new OutingRepo();

            //Act
            repo.AddOuting(outing);
            repo.AddOuting(outingTwo);
            repo.AddOuting(outingThree);

            int actual   = repo.GetOutings().Count();
            int expected = 3;

            //Assert
            Assert.AreEqual(actual, expected);
        }
Esempio n. 5
0
        public void OutingRepo_AddOuting_ShouldAddAOutingList1()
        {
            Outing e1 = new Outing("Golf", 1, DateTime.Now, 8.00, 120.00);

            _OutingRepo.AddOuting(e1);

            var actual   = _OutingRepo.GetOutingList().Count;
            var expected = 1;

            Assert.AreEqual(expected, actual);
        }
Esempio n. 6
0
        public void TestAddAndGet()
        {
            // arrange
            // Done in Test Init

            //Act
            testOutingRepo.AddOuting(outingToAdd);

            // assert
            Assert.IsTrue(testOutingRepo.GetAllOutings() != null);
        }
Esempio n. 7
0
        public void AddEvent()
        {
            Outing outingToAdd = new Outing();

            outingToAdd.Type = InputEventTypeHelper("\n Enter the type of event");
            if (outingToAdd.Type != Outing.EventType.Invalid)
            {
                outingToAdd.Attendees = InputIntHelper("\nEnter the number of attendees", "\nEnter the number of attendees as a whole number");
                outingToAdd.CostPP    = InputDoubleHelper("\nEnter the cost per person (XXX.XX)", "\nEnter the cost per person (XXX.XX) without a $");
                outingToAdd.CostTotal = InputDoubleHelper("\nEnter the total event cost (XXX.XX)", "\nEnter the total event cost (XXX.XX) without a $");
                outingToAdd.EventDate = InputDateHelper("\nEnter the event date (MM/DD/YYYY):", "\nEnter event date in the format MM/DD/YYYY.");
                AllEvents.AddOuting(outingToAdd);
            }
        }
Esempio n. 8
0
        static void Main(string[] args)
        {
            string     userInput;
            OutingRepo repo = new OutingRepo();

            do
            {
                Console.WriteLine("Please choose a menu item\n" +
                                  "1. Display a list of all outings\n" +
                                  "2. Add outing\n" +
                                  "3. Cost Statistics\n" +
                                  "4. Exit");
                userInput = Console.ReadLine();
                switch (userInput)
                {
                case "1":
                    Console.Clear();
                    repo.DisplayAll();
                    Console.WriteLine("Press any key to continue...");
                    Console.ReadKey();
                    Console.Clear();
                    break;

                case "2":
                    Console.Clear();
                    Console.WriteLine("Please enter the event type (Golf, Bowling, Amusement Park, Concert)");
                    string        eventSTR;
                    Outing.Events events = Outing.Events.Golf;
                    do
                    {
                        eventSTR = Console.ReadLine().ToLower().Replace(" ", "");
                        switch (eventSTR)
                        {
                        case "golf":
                            events = Outing.Events.Golf;
                            break;

                        case "bowling":
                            events = Outing.Events.Bowling;
                            break;

                        case "amusementpark":
                            events = Outing.Events.AmusementPark;
                            break;

                        case "concert":
                            events = Outing.Events.Concert;
                            break;

                        default:
                            Console.WriteLine("Please enter one of the options");
                            break;
                        }
                    } while (eventSTR != "golf" && eventSTR != "bowling" && eventSTR != "amusementpark" && eventSTR != "concert");
                    Console.Clear();
                    Console.WriteLine("Please enter the number of people that attended");
                    int  numberAttended;
                    bool isNumber;
                    do
                    {
                        if (int.TryParse(Console.ReadLine(), out numberAttended))
                        {
                            isNumber = true;
                        }
                        else
                        {
                            Console.WriteLine("Please enter a whole number");
                            isNumber = false;
                        }
                    } while (!isNumber);
                    Console.Clear();
                    Console.WriteLine("Please enter the date of the event (Format MM/DD/YY)");
                    DateTime date;
                    bool     isDate;
                    do
                    {
                        if (DateTime.TryParse(Console.ReadLine(), out date))
                        {
                            isDate = true;
                        }
                        else
                        {
                            Console.WriteLine("Please enter a date with the correct format");
                            isDate = false;
                        }
                    } while (!isDate);
                    Console.Clear();
                    Console.WriteLine("Please enter the cost per person for the event.");
                    decimal costPerPerson;
                    bool    isCost;
                    do
                    {
                        string costSTR = Console.ReadLine().Replace("$", "");
                        decimal.TryParse(costSTR, out costPerPerson);
                        if (decimal.Round(costPerPerson, 2) != costPerPerson || costSTR != Convert.ToString(costPerPerson))
                        {
                            Console.WriteLine("Please enter a valid number");
                            isCost = false;
                        }
                        else
                        {
                            isCost = true;
                        }
                    } while (!isCost);
                    Console.Clear();
                    Outing outing = new Outing(events, numberAttended, date, costPerPerson);
                    repo.AddOuting(outing);
                    Console.WriteLine("Outing added.\n" +
                                      "Press any key to continue...");
                    Console.ReadKey();
                    Console.Clear();
                    break;

                case "3":
                    Console.Clear();
                    repo.CombinedCosts();
                    Console.WriteLine("Press any key to continue...");
                    Console.ReadKey();
                    Console.Clear();
                    break;

                case "4":
                    break;

                default:
                    Console.WriteLine("Please choose a number between 1-4");
                    break;
                }
            } while (userInput != "4");
        }