Browse Source

Merge branch 'feature/ad_get_by_id_entity_test' of Neca/HRCenter into BE_dev

pull/156/head
safet.purkovic 3 years ago
parent
commit
7a9c70750b
1 changed files with 20 additions and 0 deletions
  1. 20
    0
      Diligent.WebAPI.Tests/Services/AdServiceTests.cs

+ 20
- 0
Diligent.WebAPI.Tests/Services/AdServiceTests.cs View File

@@ -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()
{

Loading…
Cancel
Save