Przeglądaj źródła

Get by id entity test

pull/154/head
bronjaermin 3 lat temu
rodzic
commit
47fc3d8c88
1 zmienionych plików z 20 dodań i 0 usunięć
  1. 20
    0
      Diligent.WebAPI.Tests/Services/AdServiceTests.cs

+ 20
- 0
Diligent.WebAPI.Tests/Services/AdServiceTests.cs Wyświetl plik

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

Ładowanie…
Anuluj
Zapisz