Esempio n. 1
0
        public void Test_SemiNumericComparer(string s1, string s2, int expectedResult)
        {
            /// Arrange
            var comparer = new SemiNumericComparer();

            // Act
            var result = comparer.Compare(s1, s2);

            // Assert
            result.Should().Be(expectedResult);
        }
        public List <GroupedJoinedModel> GroupTrips(List <JoinedTripsModel> joinedTripsModelList)
        {
            var semiNumericComparer = new SemiNumericComparer();

            var buses = joinedTripsModelList.Where(x => x.JoinedTrips.Any(y => y.AgencyId == 1 ||
                                                                          y.AgencyId == 6 ||
                                                                          y.AgencyId == 7 ||
                                                                          y.AgencyId == 8 ||
                                                                          y.AgencyId == 9 ||
                                                                          y.AgencyId == 10 ||
                                                                          y.AgencyId == 11 ||
                                                                          y.AgencyId == 17 ||
                                                                          y.AgencyId == 18))
                        .OrderBy(z => z.BusLineName, semiNumericComparer)
                        .ToList();

            var trams = joinedTripsModelList.Where(x => x.JoinedTrips.Any(y => y.AgencyId == 2))
                        .OrderBy(z => z.BusLineName, semiNumericComparer)
                        .ToList();
            var trolleys = joinedTripsModelList.Where(x => x.JoinedTrips.Any(y => y.AgencyId == 5))
                           .OrderBy(z => z.BusLineName, semiNumericComparer)
                           .ToList();

            return(new List <GroupedJoinedModel>()
            {
                new GroupedJoinedModel()
                {
                    Group = Group.Buses, JoinedTripModels = buses
                },
                new GroupedJoinedModel()
                {
                    Group = Group.Trams, JoinedTripModels = trams
                },
                new GroupedJoinedModel()
                {
                    Group = Group.Trolleys, JoinedTripModels = trolleys
                }
            });
        }