public async Task GetByIdAsync_GivenNotValidId_ExceptionThrown() { // Arrange var invalidId = 2; var routeService = new RouteService(TripFlipDbContext, Mapper, CurrentUserService); // Act + Assert await Assert.ThrowsExceptionAsync <NotFoundException>(async() => await routeService.GetByIdAsync(invalidId)); }
public async Task GetByIdAsync_GivenValidId_Successful() { // Arrange Seed(TripFlipDbContext, RouteEntityToSeed); var validId = 1; var routeService = new RouteService(TripFlipDbContext, Mapper, CurrentUserService); var compaper = new RouteDtoComparer(); // Act var resultRouteDto = await routeService.GetByIdAsync(validId); // Assert Assert.AreEqual(0, compaper.Compare(_expectedGotByIdRouteDto, resultRouteDto)); }