private bool IsFiltered(BusStopCollection model, List <string> filters)
 {
     filters = filters.Select(x => x.ToLower().Trim()).ToList();
     return(filters.Any(f =>
                        model.SimpleBusStops.Any(x => x.Name.ToLower().Contains(f) ||
                                                 x.Title.ToLower().Contains(f)) ||
                        model.Title.ToLower().Contains(f)));
 }
        public void HaveInnerTable_ModelHaveStops_TrueReturned(BusStopCollection model)
        {
            // Arrange
            var viewModel = new BusStopCollectionViewModel();

            // Act
            viewModel.Model = model;
            var haveInnerTable = viewModel.HaveInnerTable();

            // Assert
            haveInnerTable.ShouldBeTrue();
        }
Esempio n. 3
0
        static ViewModelTestData()
        {
            MapBusStop = new MapBusStop
            {
                LongName  = "Long",
                ShortName = "Short",
                Id        = 1,
                Id2       = 2,
                Id3       = 3,
                Latitude  = 10.2,
                Longitude = -10.2,
                Buses     = new Dictionary <int, string>
                {
                    { 1, "as" },
                    { 2, "asd" }
                }
            };

            SimpleBusStop = new SimpleBusStop
            {
                Id    = 1,
                Id2   = 2,
                Name  = "Name",
                Title = "Title"
            };

            BusStopCollection = new BusStopCollection
            {
                Id             = 1,
                Title          = "Large Title",
                SimpleBusStops = new List <SimpleBusStop>
                {
                    SimpleBusStop, SimpleBusStop, SimpleBusStop
                }
            };
        }
Esempio n. 4
0
 private void Trim(BusStopCollection model, int maxLength)
 {
     model.Title = model.Title.TrimToMaxLength(maxLength);
     model.SimpleBusStops.ForEach(x => Trim(x, maxLength));
 }