public async Task <IActionResult> Edit(int id) { var busStation = await _busStationService.GetByIdAsync(id); if (busStation == null) { return(NotFound()); } var editModel = new BusStationEditViewModel { BusStationId = busStation.BusStationId, RouteId = busStation.RouteId, BusStationName = busStation.BusStationName, BusStationCode = busStation.BusStationCode, TimeInDay = busStation.TimeInDay, TimeInNight = busStation.TimeInNight }; return(View(editModel)); }
public async Task GetByIdAsync_WithSpecifiedId_ReturnExpectedResult() { // Arrange var busStationId = 1; var expectedName = "A"; // Act var actual = await _busStationService.GetByIdAsync(busStationId); // Assert _mockAsyncRepository.Verify(m => m.GetByIdAsync(1), Times.Once); Assert.IsNotNull(actual); Assert.AreEqual(expectedName, actual.BusStationName); }