Example #1
0
        public void AllPartners_Gateway()
        {
            Logger.Log("AllPartners_Gateway");
            var      tripthru    = new TripThru(enableTDispatch: false);
            TimeSpan maxLateness = new TimeSpan(0, 25, 0);
            double   locationVerificationTolerance = 4;

            string[] filePaths = Directory.GetFiles("../../Test_Configurations/Partners/");
            Logger.Log("filePaths = " + filePaths);
            List <SubTest> subtests = new List <SubTest>();
            List <Partner> partners = new List <Partner>();

            foreach (string filename in filePaths)
            {
                Logger.Log("filename = " + filename);
                var lib = new Test_TripLifeCycle_Base(
                    filename: filename,
                    tripthru: tripthru,
                    maxLateness: maxLateness,
                    locationVerificationTolerance: locationVerificationTolerance);
                subtests.AddRange(lib.MakeSimultaneousTripLifecycle_SubTests());
                partners.Add(lib.partner);
            }


            Test_TripLifeCycle_Base.ValidateSubTests(subtests, timeoutAt: DateTime.UtcNow + new TimeSpan(0, 30, 0), simInterval: new TimeSpan(0, 0, 1), partners: partners);
        }
        public void EnoughDrivers_TwoPartnersShareJobs_Gateway()
        {
            Logger.Log("Test_TripLifeCycle_EnoughDrivers_TwoPartnersShareJobs_Gateway");
            var tripthru = new TripThru(enableTDispatch: false);
            var libA     = new Test_TripLifeCycle_Base(
                filename: "Test_Configurations/ForeignTripsEnoughDriversA.txt",
                tripthru: tripthru,
                maxLateness: new TimeSpan(0, 5, 0),
                origination: PartnerTrip.Origination.Local,
                service: PartnerTrip.Origination.Foreign,
                locationVerificationTolerance: 4);
            var libB = new Test_TripLifeCycle_Base(
                filename: "Test_Configurations/ForeignTripsEnoughDriversB.txt",
                tripthru: tripthru,
                maxLateness: new TimeSpan(0, 5, 0),
                origination: PartnerTrip.Origination.Local,
                service: PartnerTrip.Origination.Foreign,
                locationVerificationTolerance: 4);
            List <SubTest> subTests = libA.MakeSimultaneousTripLifecycle_SubTests();

            subTests.AddRange(libB.MakeSimultaneousTripLifecycle_SubTests());
            Test_TripLifeCycle_Base.ValidateSubTests(subTests,
                                                     timeoutAt: DateTime.UtcNow + new TimeSpan(0, 10, 0),
                                                     simInterval: new TimeSpan(0, 0, 1),
                                                     partners: new List <Partner>()
            {
                libA.partner, libB.partner
            });


            Assert.AreEqual(Test_TripLifeCycle_Base.request, tripthru.requests.lastHour.Count, "Request are different");
            Assert.AreEqual(Test_TripLifeCycle_Base.rejects, tripthru.rejects.lastHour.Count, "Rejects are different.");
            Assert.AreEqual(Test_TripLifeCycle_Base.cancels, tripthru.cancels.lastHour.Count, "Cancels are different");
            Assert.AreEqual(Test_TripLifeCycle_Base.completes, tripthru.completes.lastHour.Count, "Completes are different");
        }