示例#1
0
        public void GivenTheUserId_InvoiceGeneratorShouldReturnTheRideHistoryInvoice()
        {
            List <CabRidesProperties> list1 = new List <CabRidesProperties>()
            {
                new CabRidesProperties(3, 10),
                new CabRidesProperties(0.3, 2),
                new CabRidesProperties(10, 30),
                new CabRidesProperties(20, 35)
            };
            List <CabRidesProperties> list2 = new List <CabRidesProperties>()
            {
                new CabRidesProperties(2, 5),
                new CabRidesProperties(6, 9),
                new CabRidesProperties(3, 30),
                new CabRidesProperties(36, 60),
                new CabRidesProperties(12, 29)
            };
            List <CabRidesProperties> list3 = new List <CabRidesProperties>()
            {
                new CabRidesProperties(5, 9),
                new CabRidesProperties(15, 24),
                new CabRidesProperties(8, 35)
            };
            Dictionary <int, List <CabRidesProperties> > keyValuePairs = new Dictionary <int, List <CabRidesProperties> >();

            keyValuePairs.Add(1, list1);
            keyValuePairs.Add(2, list2);
            keyValuePairs.Add(3, list3);
            List <CabRidesProperties> values = InviceGenerator.GetRideHistoryByUserID(keyValuePairs, 3);

            Assert.NotZero(values.Capacity);
        }
示例#2
0
        public void SelectTheCategory_FindThe_Fare()
        {
            //1 for normal category
            //2 for premium category
            double fare = InviceGenerator.PremiumAndNormalRideFare(2, 4.2, 10);

            Assert.AreEqual(83, fare);
        }
示例#3
0
        public void GivenMultipleData_inviceGeneratorShouldReturnTotalCost()
        {
            List <CabRidesProperties> list = new List <CabRidesProperties>()
            {
                new CabRidesProperties(2.3, 8),
                new CabRidesProperties(0.3, 2),
                new CabRidesProperties(8, 21),
                new CabRidesProperties(20, 35)
            };
            double cost = InviceGenerator.GenerateMonthlyFare(list);

            Assert.AreEqual(372, cost);
        }
示例#4
0
        public void GivenMultipleData_InviceGeneratorShouldReturnRidesFareAndAvrageFare()
        {
            List <CabRidesProperties> list1 = new List <CabRidesProperties>()
            {
                new CabRidesProperties(3, 10),
                new CabRidesProperties(0.3, 2),
                new CabRidesProperties(10, 30),
                new CabRidesProperties(20, 35)
            };
            List <CabRidesProperties> list2 = new List <CabRidesProperties>()
            {
                new CabRidesProperties(2, 5),
                new CabRidesProperties(6, 9),
                new CabRidesProperties(3, 30),
                new CabRidesProperties(36, 60),
                new CabRidesProperties(12, 29)
            };
            List <CabRidesProperties> list3 = new List <CabRidesProperties>()
            {
                new CabRidesProperties(5, 9),
                new CabRidesProperties(15, 24),
                new CabRidesProperties(8, 35)
            };
            Dictionary <int, List <CabRidesProperties> > keyValuePairs = new Dictionary <int, List <CabRidesProperties> >();

            keyValuePairs.Add(1, list1);
            keyValuePairs.Add(2, list2);
            keyValuePairs.Add(3, list3);
            List <EnhancedInvoiceProperties> values = InviceGenerator.CalculateTotalRides_TotalFare_AvgFare(keyValuePairs);

            foreach (var item in values)
            {
                Assert.NotZero(item.TotalNumberRides);
                Assert.NotZero(item.TotalFare);
                Assert.NotZero(item.AverageFarePerRide);
            }
        }
示例#5
0
        public void GivenDistanceAndTime_InviceGenerator_ShouldReturnTotalFareOfJourney()
        {
            double cost = InviceGenerator.GenerateFare(1.8, 5);

            Assert.AreEqual(23, cost);
        }