| @@ -104,6 +104,26 @@ namespace Diligent.WebAPI.Tests.Services | |||
| 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] | |||
| public async Task GetAdDetailsById_ShouldReturnAd_WhenAdExists() | |||
| { | |||