public async Task GetByIdAsync_ShouldSuccessfullyGet() { MapperInitializer.InitializeMapper(); var context = ApplicationDbContextInMemoryFactory.InitializeContext(); await this.SeedDataAsync(context); var truckService = new TruckService(context); await truckService.GetByIdAsync(1); var expectedResult = "TRN 1"; var actualResult = await truckService.GetByIdAsync(1); Assert.True(expectedResult == actualResult.RegistrationNumber); }
public async Task GetByIdAsync_WithNonExistingId_ShouldThrowArgumentNullException() { MapperInitializer.InitializeMapper(); var context = ApplicationDbContextInMemoryFactory.InitializeContext(); await this.SeedDataAsync(context); var truckService = new TruckService(context); await Assert.ThrowsAsync <ArgumentNullException>(async() => { await truckService.GetByIdAsync(3); }); }