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");
        }
示例#2
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);
        }
示例#3
0
        public void EnoughDrivers_SingleTrips()
        {
            Logger.Log("Test_TripLifeCycle_EnoughDrivers_SingleTrips");
            Test_TripLifeCycle_Base lib = new Test_TripLifeCycle_Base("Test_Configurations/LocalTripsEnoughDrivers.txt",
                                                                      tripthru: new GatewayServer("EmptyGateway", "EmptyGateway"),
                                                                      maxLateness: new TimeSpan(0, 5, 0));

            lib.Test_SingleTripLifecycle_ForAllPartnerFleets();
        }
示例#4
0
 public UnitTest_SingleTripLifecycleAndReturningDriver(Test_TripLifeCycle_Base parent, PartnerFleet fleet, Pair <Location, Location> tripSpec)
 {
     if (parent == null)
     {
         throw new Exception("parent must be defined");
     }
     this.parent   = parent;
     this.fleet    = fleet;
     this.tripSpec = tripSpec;
 }
示例#5
0
        public void EnoughDrivers_SingleTrips()
        {
            Logger.Log("Test_TripLifeCycle_EnoughDrivers_SingleTrips");
            var tripthru = new TripThru(enableTDispatch: false);
            Test_TripLifeCycle_Base lib = new Test_TripLifeCycle_Base("Test_Configurations/LocalTripsEnoughDrivers.txt",
                                                                      tripthru: tripthru,
                                                                      maxLateness: new TimeSpan(0, 5, 0));

            lib.Test_SingleTripLifecycle_ForAllPartnerFleets();
            Assert.AreEqual(lib.partner.distance.lastHour.Value, tripthru.distance.lastHour.Value, "Distances are different");
            Assert.AreEqual(lib.partner.fare.lastHour.Value, tripthru.fare.lastHour.Value, "Fares are different");
        }
示例#6
0
        public void NotEnoughDrivers_SingleTrips()
        {
            Logger.Log("Test_TripLifeCycle_NotEnoughDrivers_SingleTrips");

            /* In this test since there are not enough drivers it tries to dispatch to tripthru --
             * which has an empty implementation that always rejects.
             * We expect an assertion error because we expect the trip status to change from Queued to Dispatched
             * */
            Test_TripLifeCycle_Base lib = new Test_TripLifeCycle_Base(
                filename: "Test_Configurations/LocalTripsNotEnoughDrivers.txt",
                tripthru: new GatewayServer("EmptyGateway", "EmptyGateway"),
                maxLateness: new TimeSpan(0, 1, 0));

            lib.Test_SingleTripLifecycle_ForAllPartnerFleets();
        }
示例#7
0
        public void NotEnoughDrivers_SingleTrips()
        {
            Logger.Log("Test_TripLifeCycle_NotEnoughDrivers_SingleTrips");

            /* In this test since there are not enough drivers it tries to dispatch to tripthru --
             * which has an empty implementation that always rejects.
             * We expect an assertion error because we expect the trip status to change from Queued to Dispatched
             * */
            var tripthru = new TripThru(enableTDispatch: false);
            Test_TripLifeCycle_Base lib = new Test_TripLifeCycle_Base(
                filename: "Test_Configurations/LocalTripsNotEnoughDrivers.txt",
                tripthru: tripthru,
                maxLateness: new TimeSpan(0, 1, 0));

            lib.Test_SingleTripLifecycle_ForAllPartnerFleets();
            Assert.AreEqual(lib.partner.distance.lastHour.Value, tripthru.distance.lastHour.Value, "Distances are different");
            Assert.AreEqual(lib.partner.fare.lastHour.Value, tripthru.fare.lastHour.Value, "Fares are different");
        }
示例#8
0
        public void NotEnoughDrivers_SingleTrips()
        {
            Logger.Log("Test_TripLifeCycle_NotEnoughDrivers_SingleTrips");
            /* In this test since there are not enough drivers it tries to dispatch to tripthru --
             * which has an empty implementation that always rejects.
             * We expect an assertion error because we expect the trip status to change from Queued to Dispatched
             * */
            var tripthru = new TripThru(enableTDispatch: false);
            Test_TripLifeCycle_Base lib = new Test_TripLifeCycle_Base(
                filename: "Test_Configurations/LocalTripsNotEnoughDrivers.txt",
                tripthru: tripthru,
                maxLateness: new TimeSpan(0, 1, 0));

            lib.Test_SingleTripLifecycle_ForAllPartnerFleets();
            Assert.AreEqual(lib.partner.distance.lastHour.Value, tripthru.distance.lastHour.Value, "Distances are different");
            Assert.AreEqual(lib.partner.fare.lastHour.Value, tripthru.fare.lastHour.Value, "Fares are different");
        }
示例#9
0
        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});

            Thread.Sleep(new TimeSpan(0,0,1));

            Assert.AreEqual(Test_TripLifeCycle_Base.requests, 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");
            Assert.AreEqual(Test_TripLifeCycle_Base.distance, tripthru.distance.lastHour.Value, "Distances are different");
            Assert.AreEqual(Test_TripLifeCycle_Base.fare, tripthru.fare.lastHour.Value, "Fares are different");

            Assert.AreEqual(Test_TripLifeCycle_Base.requests, tripthru.requests.last24Hrs.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.last24Hrs.Count, "Cancels are different");
            Assert.AreEqual(Test_TripLifeCycle_Base.completes, tripthru.completes.last24Hrs.Count, "Completes are different");
            Assert.AreEqual(Test_TripLifeCycle_Base.distance, tripthru.distance.last24Hrs.Value, "Distances are different");
            Assert.AreEqual(Test_TripLifeCycle_Base.fare, tripthru.fare.last24Hrs.Value, "Fares are different");

            Assert.AreEqual(Test_TripLifeCycle_Base.requests, tripthru.requests.allTime.value, "Request are different");
            Assert.AreEqual(Test_TripLifeCycle_Base.rejects, tripthru.rejects.allTime.value, "Rejects are different.");
            Assert.AreEqual(Test_TripLifeCycle_Base.cancels, tripthru.cancels.allTime.value, "Cancels are different");
            Assert.AreEqual(Test_TripLifeCycle_Base.completes, tripthru.completes.allTime.value, "Completes are different");
            Assert.AreEqual(Test_TripLifeCycle_Base.distance, tripthru.distance.allTime.value, "Distances are different");
            Assert.AreEqual(Test_TripLifeCycle_Base.fare, tripthru.fare.allTime.value, "Fares are different");
        }
示例#10
0
 public void EnoughDrivers_SingleTrips()
 {
     Logger.Log("Test_TripLifeCycle_EnoughDrivers_SingleTrips");
     var tripthru = new TripThru(enableTDispatch: false);
     Test_TripLifeCycle_Base lib = new Test_TripLifeCycle_Base("Test_Configurations/LocalTripsEnoughDrivers.txt",
         tripthru: tripthru,
         maxLateness: new TimeSpan(0, 5, 0));
     lib.Test_SingleTripLifecycle_ForAllPartnerFleets();
     Assert.AreEqual(lib.partner.distance.lastHour.Value, tripthru.distance.lastHour.Value, "Distances are different");
     Assert.AreEqual(lib.partner.fare.lastHour.Value, tripthru.fare.lastHour.Value, "Fares are different");
 }
示例#11
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/Networks/");
            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);
        }
示例#12
0
 public UnitTest_SingleTripLifecycleAndReturningDriver(Test_TripLifeCycle_Base parent, PartnerFleet fleet, Pair<Location, Location> tripSpec)
 {
     if (parent == null)
         throw new Exception("parent must be defined");
     this.parent = parent;
     this.fleet = fleet;
     this.tripSpec = tripSpec;
 }
        public void NotEnoughDrivers_SingleTrips()
        {
            Logger.Log("Test_TripLifeCycle_NotEnoughDrivers_SingleTrips");
            /* In this test since there are not enough drivers it tries to dispatch to tripthru --
             * which has an empty implementation that always rejects.
             * We expect an assertion error because we expect the trip status to change from Queued to Dispatched
             * */
            Test_TripLifeCycle_Base lib = new Test_TripLifeCycle_Base(
                filename: "Test_Configurations/LocalTripsNotEnoughDrivers.txt",
                tripthru: new GatewayServer("EmptyGateway", "EmptyGateway"),
                maxLateness: new TimeSpan(0, 1, 0));

            lib.Test_SingleTripLifecycle_ForAllPartnerFleets();
        }
 public void EnoughDrivers_SingleTrips()
 {
     Logger.Log("Test_TripLifeCycle_EnoughDrivers_SingleTrips");
     Test_TripLifeCycle_Base lib = new Test_TripLifeCycle_Base("Test_Configurations/LocalTripsEnoughDrivers.txt",
         tripthru: new GatewayServer("EmptyGateway", "EmptyGateway"),
         maxLateness: new TimeSpan(0, 5, 0));
     lib.Test_SingleTripLifecycle_ForAllPartnerFleets();
 }