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