Example #1
0
        public CombinedTripModel CombineForBothWays(List <OrganizedTrips> trips)
        {
            var firstMainStartTrip  = _combineHelper.GetMainRoute(trips, TripKey.START);
            var firstMainReturnTrip = _combineHelper.GetMainRoute(trips, TripKey.RETURN);

            firstMainStartTrip.Stops  = _combineHelper.GetJoinedStops(trips.Where(x => x.Trips.ContainsKey(TripKey.START)).ToList(), firstMainStartTrip.Stops, TripKey.START);
            firstMainReturnTrip.Stops = _combineHelper.GetJoinedStops(trips.Where(x => x.Trips.ContainsKey(TripKey.RETURN)).ToList(), firstMainReturnTrip.Stops, TripKey.RETURN);

            return(new CombinedTripModel()
            {
                BusLineName = firstMainStartTrip.BusLineName,
                Trips = new List <Trip>()
                {
                    firstMainStartTrip, firstMainReturnTrip
                }
            });
        }
Example #2
0
        public void GetMainRoute_Start_Test()
        {
            var list = TripMaker.GetOrganizedTripList(true);
            var ch   = new CombineHelper(new StopComparer());

            var tripToCheck = ch.GetMainRoute(list, TripKey.START);

            Assert.IsTrue(tripToCheck.MainRoute);
        }