| await Assert.ThrowsAsync<EntityNotFoundException>(async () => await adService.GetByIdAsync(1000)); | await Assert.ThrowsAsync<EntityNotFoundException>(async () => await adService.GetByIdAsync(1000)); | ||||
| } | } | ||||
| [Fact] | |||||
| public async Task GetByIdEntity_ShouldReturnAd_WhenAdExists() | |||||
| { | |||||
| var databaseContext = await Helpers<Ad>.GetDatabaseContext(_ads); | |||||
| AdService adService = new(databaseContext, _mapper, _technologyService, _logger); | |||||
| var result = await adService.GetByIdEntityAsync(1); | |||||
| result.Should().BeEquivalentTo(_ad); | |||||
| } | |||||
| [Fact] | |||||
| public async Task GetByIdEntity_ShouldThrowEntityNotFoundException_WhenAdDontExists() | |||||
| { | |||||
| var databaseContext = await Helpers<Ad>.GetDatabaseContext(_ads); | |||||
| AdService adService = new(databaseContext, _mapper, _technologyService, _logger); | |||||
| await Assert.ThrowsAsync<EntityNotFoundException>(async () => await adService.GetByIdEntityAsync(1000)); | |||||
| } | |||||
| [Fact] | [Fact] | ||||
| public async Task GetAdDetailsById_ShouldReturnAd_WhenAdExists() | public async Task GetAdDetailsById_ShouldReturnAd_WhenAdExists() | ||||
| { | { |