public void ShouldBeAbleToSaveDataToDB() { var logs = new List <LogOutput>(); var uniqueClassOptions = SqliteInMemory.CreateOptionsWithLogging <MyDbContext>(output => { Console.WriteLine(output); logs.Add(output); }); using (var context = new MyDbContext(uniqueClassOptions)) { context.CreateEmptyViaWipe(); context.Database.EnsureCreated(); var author = new Author { NickName = "Dr.Who", FirstName = "Doctor", LastName = "Who", Email = "*****@*****.**" }; var userA = new User { Email = "*****@*****.**", FirstName = "Ted", LastName = "Test", NickName = "TestA" }; var userB = new User { Email = "*****@*****.**", FirstName = "Jim", LastName = "Test", NickName = "TestB" }; var post = new Post { Content = "first post irst post", Comments = new[] { new Comment { User = userA, CommentContent = "hhh" }, new Comment { User = userB, CommentContent = "bbb" }, }, Author = author }; context.Posts.Add(post); context.SaveChanges(); Assert.That(context.Posts.First().PostId, Is.Not.Empty); } }