diff --git a/tp1/TestStub/tp.Books.db b/tp1/TestStub/tp.Books.db index 53ca108..36be9b0 100644 Binary files a/tp1/TestStub/tp.Books.db and b/tp1/TestStub/tp.Books.db differ diff --git a/tp1/TestStub/tp.Books.db-shm b/tp1/TestStub/tp.Books.db-shm deleted file mode 100644 index ac1fa32..0000000 Binary files a/tp1/TestStub/tp.Books.db-shm and /dev/null differ diff --git a/tp1/TestStub/tp.Books.db-wal b/tp1/TestStub/tp.Books.db-wal deleted file mode 100644 index de876e1..0000000 Binary files a/tp1/TestStub/tp.Books.db-wal and /dev/null differ diff --git a/tp1/UnitTests/UnitTest1.cs b/tp1/UnitTests/UnitTest1.cs index ad78092..412e432 100644 --- a/tp1/UnitTests/UnitTest1.cs +++ b/tp1/UnitTests/UnitTest1.cs @@ -143,6 +143,7 @@ namespace UnitTests } } + [Fact] public void Delete_TestPerson() { var connection = new SqliteConnection("DataSource=:memory:"); @@ -165,25 +166,25 @@ namespace UnitTests } } + [Fact] public void Delete_TestBook() { var connection = new SqliteConnection("DataSource=:memory:"); connection.Open(); var options = new DbContextOptionsBuilder().UseSqlite().Options; - var nb; + //prepares the database with one instance of the context //prepares the database with one instance of the context using (var context = new StubbedContext(options)) - { - + { context.PersonSet.Include(pers => pers.Books).ToList(); - nb = context.BooksSet.Count(); + var nb = context.BooksSet.Count(); if (nb > 0) { context.BooksSet.Remove(context.BooksSet.FirstOrDefault()); } - Assert.Equal(context.BooksSet.Count, nb - 1); + Assert.Equal(context.BooksSet.Count(), nb - 1); context.SaveChanges(); } }