public StationsController(ILogger <StationsController> logger, ILookupStationsService lookupStationsService, IMapper mapper) { _logger = logger; _lookupStationsService = lookupStationsService; _mapper = mapper; }
public async Task SearchTopContains_NamePartLowerCase_ReturnUpperCase() { // arrange var stations = new List <Station> { new Station("TestTest", "tst"), new Station("TEST_", "tst_"), new Station("Name", "nm"), new Station("XyZ", "xyz") }; _stationsRepository.Setup(s => s.AsQueryable()).Returns(stations.AsQueryable().BuildMock().Object); _lookupStationsService = new LookupStationsService(_stationsRepository.Object); // act var foundStations = (await _lookupStationsService.GetByAnyNamePartAsync("test")).ToArray(); // assert CollectionAssert.AllItemsAreUnique(foundStations); CollectionAssert.AllItemsAreNotNull(foundStations); CollectionAssert.AllItemsAreInstancesOfType(foundStations, typeof(Station)); CollectionAssert.AreEqual(foundStations.Select(s => s.Name).ToArray(), new [] { "TEST_", "TestTest" }); Assert.IsTrue(foundStations.Length == 2); }
public void Cleanup() { _stationsRepository = null; _lookupStationsService = null; }