diff --git a/Sources/TestAPI/TestAPI.csproj b/Sources/TestAPI/TestAPI.csproj index bdd1ae2..0c60af0 100644 --- a/Sources/TestAPI/TestAPI.csproj +++ b/Sources/TestAPI/TestAPI.csproj @@ -21,4 +21,8 @@ + + + + diff --git a/Sources/Tests/TestEF/UnitTestChampion.cs b/Sources/Tests/TestEF/UnitTestChampion.cs index a9a5be1..3b7319b 100644 --- a/Sources/Tests/TestEF/UnitTestChampion.cs +++ b/Sources/Tests/TestEF/UnitTestChampion.cs @@ -28,7 +28,7 @@ namespace TestEF Assert.Equal("Akali", champs.Name); } } - /* + [Fact] public void Modify_Test() { @@ -36,51 +36,49 @@ namespace TestEF var connection = new SqliteConnection("DataSource=:memory:"); connection.Open(); - var options = new DbContextOptionsBuilder() - .UseSqlite(connection) - .Options; + var options = new DbContextOptionsBuilder().UseSqlite(connection).Options; //prepares the database with one instance of the context - using (var context = new NounoursContext(options)) + using (var context = new StubEFChampions(options)) { //context.Database.OpenConnection(); context.Database.EnsureCreated(); - +/* Nounours chewie = new Nounours { Nom = "Chewbacca" }; Nounours yoda = new Nounours { Nom = "Yoda" }; Nounours ewok = new Nounours { Nom = "Ewok" }; context.Nounours.Add(chewie); context.Nounours.Add(yoda); - context.Nounours.Add(ewok); + context.Nounours.Add(ewok);*/ context.SaveChanges(); } //uses another instance of the context to do the tests - using (var context = new NounoursContext(options)) + using (var context = new StubEFChampions(options)) { context.Database.EnsureCreated(); string nameToFind = "ew"; - Assert.Equal(2, context.Nounours.Where(n => n.Nom.ToLower().Contains(nameToFind)).Count()); + Assert.Equal(2, context.Champions.Where(n => n.Name.ToLower().Contains(nameToFind)).Count()); nameToFind = "wo"; - Assert.Equal(1, context.Nounours.Where(n => n.Nom.ToLower().Contains(nameToFind)).Count()); - var ewok = context.Nounours.Where(n => n.Nom.ToLower().Contains(nameToFind)).First(); - ewok.Nom = "Wicket"; + Assert.Equal(1, context.Champions.Where(n => n.Name.ToLower().Contains(nameToFind)).Count()); + var ewok = context.Champions.Where(n => n.Name.ToLower().Contains(nameToFind)).First(); + ewok.Name = "Wicket"; context.SaveChanges(); } //uses another instance of the context to do the tests - using (var context = new NounoursContext(options)) + using (var context = new StubEFChampions(options)) { context.Database.EnsureCreated(); string nameToFind = "ew"; - Assert.Equal(1, context.Nounours.Where(n => n.Nom.ToLower().Contains(nameToFind)).Count()); + Assert.Equal(1, context.Champions.Where(n => n.Name.ToLower().Contains(nameToFind)).Count()); nameToFind = "wick"; - Assert.Equal(1, context.Nounours.Where(n => n.Nom.ToLower().Contains(nameToFind)).Count()); + Assert.Equal(1, context.Champions.Where(n => n.Name.ToLower().Contains(nameToFind)).Count()); } - }*/ + } /* [SetUp] public void Setup() @@ -126,8 +124,8 @@ namespace TestEF var champions = objectResult?.Value as ChampionDto; Assert.IsNotNull(champions); - }*/ - + } + */ } } \ No newline at end of file