I've got following integration test for a repository:
public class RepositoryTests
{
[Fact]
public async Task GetAllAdressen_ReturnsEntities_OK_Test()
{
await GetAll_ReturnsEntities_OK_Test<AdresseEntity>();
}
[Fact]
public async Task GetAllApplikationsarten_ReturnsEntities_OK_Test()
{
await GetAll_ReturnsEntities_OK_Test<ApplikationsartEntity>();
}
private static async Task GetAll_ReturnsEntities_OK_Test<TEntity>()
where TEntity : BaseEntity
{
// Arrange
var dbContext = new SaiTestContext();
var repository = new Repository<TEntity>(dbContext);
// Act
var entities = await repository.GetAllAsync();
// Assert
Assert.NotEmpty(entities);
}
}
Is there a way to remove both [Fact]
and convert the private static async Task GetAll_ReturnsEntities_OK_Test<TEntity>()
into a [Theory]
while specifying TEntity
somehow with InlineData
?