diff --git a/Sources/TestUnitaire/TestEfLol.cs b/Sources/TestUnitaire/TestEfLol.cs index 00b1923..ddaf938 100644 --- a/Sources/TestUnitaire/TestEfLol.cs +++ b/Sources/TestUnitaire/TestEfLol.cs @@ -6,8 +6,11 @@ namespace TestUnitaire { public class TestEfLol { - [Fact] - public async Task TestAddInMemory() + [Theory] + [InlineData("zeus","dieu")] + [InlineData("zeus", "dieu")] + [InlineData("zeus", "dieu")] + public async Task TestAddInMemory(String name, String bio) { // Arrange var connection = new SqliteConnection("DataSource=:memory:"); @@ -21,29 +24,23 @@ namespace TestUnitaire using (var context = new ChampionContext(options)) { await context.Database.EnsureCreatedAsync(); - var Zeus = new ChampionEntity - { - Name = "Zeus", - Bio = "Zeus is the king of the gods." - }; - var Poseidon = new ChampionEntity + var Dieu = new ChampionEntity { - Name = "Poseidon", - Bio = "Poseidon is the king of the sea." + Name = name, + Bio = bio }; ChampionEntity found = await context.Champions.SingleOrDefaultAsync(c => c.Name == "Zeus"); Assert.Null(found); - await context.Champions.AddAsync(Zeus); - await context.Champions.AddAsync(Poseidon); + await context.Champions.AddAsync(Dieu); await context.SaveChangesAsync(); - found = await context.Champions.SingleOrDefaultAsync(c => c.Name == "Zeus"); + found = await context.Champions.SingleOrDefaultAsync(c => c.Name == name); Assert.NotNull(found); - Assert.Equal(2, await context.Champions.CountAsync()); - Assert.Equal("Zeus", found.Name); + Assert.Equal(1, await context.Champions.CountAsync()); + Assert.Equal(name, found.Name); } }