private bool IsFiltered(MapBusStop model, List <string> filters) { filters = filters.Select(x => x.ToLower().Trim()).ToList(); return(filters.Any(f => model.Buses.Any(x => x.Value.ToLower().Contains(f)) || model.LongName.ToLower().Contains(f) || model.ShortName.ToLower().Contains(f))); }
public void HaveInnerTable_ModelHaveBusses_TrueReturned(MapBusStop model) { // Arrange var viewModel = new MapBusStopViewModel(); // Act viewModel.Model = model; var haveInnerTable = viewModel.HaveInnerTable(); // Assert haveInnerTable.ShouldBeTrue(); }
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 } }; }
private void Trim(MapBusStop model, int maxLength) { model.LongName = model.LongName.TrimToMaxLength(maxLength); model.ShortName = model.ShortName.TrimToMaxLength(maxLength); }