コード例 #1
0
        public void OutingRepository_CalculateCostByType_ShouldBeCorrectCost()
        {
            OutingRepository _outingRepo = new OutingRepository();
            Outing           outing      = new Outing();
            Outing           outingTwo   = new Outing();
            Outing           outingThree = new Outing();

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

            outing.TypeOfEvent      = EventType.Golf;
            outingTwo.TypeOfEvent   = EventType.Golf;
            outingThree.TypeOfEvent = EventType.Bowling;

            outing.TotalCost      = 200;
            outingTwo.TotalCost   = 200;
            outingThree.TotalCost = 100;

            decimal actual   = _outingRepo.CalculateCostOfEventType(EventType.Golf);
            decimal expected = 400;

            Assert.AreEqual(expected, actual);

            decimal actualTwo   = _outingRepo.CalculateCostOfEventType(EventType.Bowling);
            decimal expectedTwo = 100;

            Assert.AreEqual(expectedTwo, actualTwo);
        }
コード例 #2
0
        public void Outing_CostByEventType_ShouldGetTotalForEventType()
        {
            //-- Arrange
            OutingRepository _outingsRepo = new OutingRepository();
            DateTime         date1        = new DateTime(2018, 4, 25);
            DateTime         date2        = new DateTime(2018, 5, 25);
            DateTime         date3        = new DateTime(2018, 6, 25);
            DateTime         date4        = new DateTime(2018, 7, 25);
            Outings          outing1      = new Outings("Golf", 4, date1, 100.00);
            Outings          outing2      = new Outings("Golf", 4, date2, 80.00);
            Outings          outing3      = new Outings("Amusement Park", 4, date3, 200.00);
            Outings          outing4      = new Outings("Concert", 4, date4, 400.00);

            _outingsRepo.AddOutingToList(outing1);
            _outingsRepo.AddOutingToList(outing2);
            _outingsRepo.AddOutingToList(outing3);
            _outingsRepo.AddOutingToList(outing4);

            //-- Act
            double expected = 180;
            double actual   = _outingsRepo.EventType("Golf");

            //-- Assert
            Assert.AreEqual(expected, actual);
        }
コード例 #3
0
        public void SeedRepository()
        {
            Outing one   = new Outing(EventType.Concert, 34, new DateTime(2020, 05, 10), 120.00m);
            Outing two   = new Outing(EventType.Golf, 15, new DateTime(2020, 04, 15), 35.50m);
            Outing three = new Outing(EventType.AmusementPark, 38, new DateTime(2020, 01, 15), 195.75m);

            _outingRepo.AddOutingToList(one);
            _outingRepo.AddOutingToList(two);
            _outingRepo.AddOutingToList(three);
        }
コード例 #4
0
    public void Challenge3Q()
    {
        Outings one = new Outings((Event)4, 13, "07/13/1986", 777, 1);

        oRepo.AddOutingToList(one);

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

        Assert.AreEqual(actual, expected);
    }
コード例 #5
0
        public void Challenge1_OutingsRepo_ShouldReturnQueuewithCount1()
        {
            Outings one = new Outings((Event)1, 10, "01/22/2018", 20, 200);

            outRepo.AddOutingToList(one);

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

            Assert.AreEqual(actual, expected);
        }
コード例 #6
0
        public void OutingRepository_AddOuting()
        {
            //Arrange
            Outing newOuting = new Outing("Flag Football", 500, 10, DateTime.Parse("04/03/2020"));

            outingrepo.AddOutingToList(newOuting);
            List <Outing> outings = outingrepo.GetOutings();

            //Act
            int actual   = outings.Count;
            int expected = 5;

            //Assert
            Assert.AreEqual(expected, actual);
        }
コード例 #7
0
        public void OutingRepository_AddOuting_ShouldReturnCorrectCount()
        {
            OutingRepository _outingRepo = new OutingRepository();
            Outing           outing      = new Outing();
            Outing           outingTwo   = new Outing();
            Outing           outingThree = new Outing();

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

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

            Assert.AreEqual(expected, actual);
        }
コード例 #8
0
ファイル: UnitTest1.cs プロジェクト: LozierMark/Challenge-One
        public void OutingRepository_AddOutingToList_ShouldReturnCorrectCount()
        {
            //Arrange
            OutingEvent      outing    = new OutingEvent();
            OutingEvent      outingTwo = new OutingEvent();
            OutingRepository repo      = new OutingRepository();

            //Act
            repo.AddOutingToList(outing);
            repo.AddOutingToList(outingTwo);

            int actual   = repo.GetOutingList().Count;
            int expected = 2;

            //Assert
            Assert.AreEqual(expected, actual);
        }
コード例 #9
0
        public void AddTest()
        {
            // populate outings
            SeedOutingList();

            // test AddOutingToList()
            _outingRepo.AddOutingToList(new Outing(TypeOfEvent.Concert, 200, new DateTime(2020, 09, 12), 35.70m));
            Assert.AreEqual(7, _outingRepo.GetListOfOutings().Count);
        }
コード例 #10
0
        public void OutingRepository_AddOutingCostByType_ShouldReturnCorrectCost()
        {
            //EventType type, int attendants, DateTime eventDate, decimal costPerPerson, decimal eventCost
            EventType         type       = EventType.Bowling;
            OutingRepository  outingRepo = new OutingRepository();
            OutingInformation outing     = new OutingInformation(EventType.Bowling, 45, DateTime.Now, 5.50m, 25000);
            OutingInformation outingOne  = new OutingInformation(EventType.Bowling, 45, DateTime.Now, 5.50m, 25000);
            OutingInformation outingTwo  = new OutingInformation(EventType.Bowling, 45, DateTime.Now, 5.50m, 25000);
            OutingInformation outingFour = new OutingInformation(EventType.Golf, 45, DateTime.Now, 5.50m, 25000);

            outingRepo.AddOutingToList(outing);
            outingRepo.AddOutingToList(outingOne);
            outingRepo.AddOutingToList(outingTwo);
            outingRepo.AddOutingToList(outingFour);

            decimal actual   = outingRepo.CalculateCostByType(type);
            decimal expected = 75000m;

            Assert.AreEqual(expected, actual);
        }
コード例 #11
0
        public void OutingRepository_CalculateTotalCost_ShouldBeCorrectValue()
        {
            OutingRepository _outingRepo = new OutingRepository();
            Outing           outing      = new Outing();
            Outing           outingTwo   = new Outing();
            Outing           outingThree = new Outing();

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

            outing.TotalCost      = 200;
            outingTwo.TotalCost   = 200;
            outingThree.TotalCost = 100;

            decimal actual   = _outingRepo.CalculateCostOfAllEvents();
            decimal expected = 500;

            Assert.AreEqual(expected, actual);
        }
コード例 #12
0
        public void TestAddClaimToQueue()
        {
            Outings outings = new Outings();

            _outingRepo = new OutingRepository();

            _outingRepo.AddOutingToList(outings);

            int expected = 1;
            int actual   = _outingRepo.GetOutingList().Count;

            Assert.AreEqual(expected, actual);
        }
コード例 #13
0
        public void OutingRepository_AddItem_CountShouldIncrease()
        {
            //-- Arrange
            Outing outing1 = new Outing(7, "10/10/2010", 25.00m, 175.00, (OutingType)1);

            outingRepo.AddOutingToList(outing1);
            List <Outing> outingListTest = outingRepo.GetList();

            //-- Act
            int actual   = outingListTest.Count;
            int expected = 1;

            //-- Assert
            Assert.AreEqual(expected, actual);
        }
コード例 #14
0
        public void Outing_AddToList_ShouldAddToList()
        {
            //-- Arrange
            OutingRepository _outingsRepo = new OutingRepository();
            DateTime         date1        = new DateTime(2018, 4, 25);
            Outings          outing1      = new Outings("Golf", 4, date1, 100.00);

            _outingsRepo.AddOutingToList(outing1);

            //-- Act
            int expected = 1;
            int actual   = _outingsRepo.GetCount();

            //-- Assert
            Assert.AreEqual(expected, actual);
        }
コード例 #15
0
        private void AddOuting()
        {
            Outing outing = new Outing();
            Console.WriteLine("Enter event type:");
            outing.EventType = Console.ReadLine();
            Console.WriteLine("Enter event date(dd/MM/yyyy)):");
            outing.EventDate = DateTime.Parse(Console.ReadLine());
            Console.WriteLine("Enter attendance numbers:");
            outing.EventAttendance = int.Parse(Console.ReadLine());
            Console.WriteLine("Enter cost per person:");
            outing.EventCostPerPerson = decimal.Parse(Console.ReadLine());
            outing.EventCost = outing.EventAttendance * outing.EventCostPerPerson;
            ReturnToMenu();

            _outingRepository.AddOutingToList(outing);
            Console.Clear();
        }
コード例 #16
0
        public void AddOuting()
        {
            Outing newOuting = new Outing();

            Console.WriteLine("Enter the Outing Type:\n" +
                              "1. Golf\n" +
                              "2. Bowling\n" +
                              "3. Amusement Park\n" +
                              "4. Concert");
            string outingType       = Console.ReadLine();
            int    outingTypeNumber = int.Parse(outingType);

            newOuting.EventType = (EventType)outingTypeNumber;

            Console.WriteLine("Enter the Number of Attendees: ");
            newOuting.NumberOfAttendees = int.Parse(Console.ReadLine());

            Console.WriteLine("Enter the Date of the Outing(e.g. 08/28/1996): ");
            newOuting.Date = DateTime.Parse(Console.ReadLine());

            _repo.AddOutingToList(newOuting);
        }
コード例 #17
0
        private void CreateNewOuting()
        {
            // get date of outing
            Console.Write("Enter the date Of outing (MM/dd/yyyy): ");
            DateTime newOutingDate = Utilites.GetDateFromUser();

            // get event type and make sure it is valid
            int newEventType;

            do
            {
                Console.WriteLine("Enter the type Of outing: ");
                foreach (var eventType in Enum.GetValues(typeof(TypeOfEvent)))
                {
                    Console.WriteLine($"{(int)eventType} for {eventType}.");
                }
                newEventType = Utilites.GetIntFromUser();
                if (Enum.IsDefined(typeof(TypeOfEvent), newEventType) == false)
                {
                    Console.WriteLine("Please enter a valid number.");
                }
            } while (Enum.IsDefined(typeof(TypeOfEvent), newEventType) == false);

            // get Attendance
            Console.Write("Enter the number in attendance: ");
            int newAttendance = Utilites.GetIntFromUser();

            // get cost per person
            Console.Write("Enter the cost per person: ");
            decimal newCostPerPerson = Utilites.GetDecimalFromUser();

            // add event to list
            _outingRepo.AddOutingToList(new Outing((TypeOfEvent)newEventType, newAttendance, newOutingDate, newCostPerPerson));

            // show event was added
            Console.WriteLine("The event was added.");
        }