I am studying packtpub's entity framework core cookbook on unit test, there is an example (I made some change)
[Fact]
public void CanCreateDatabase()
{
var blogContext = new BlogContext(_builder.Options);
var created = blogContext.Database.EnsureCreated();
Assert.True(created);
}
[Fact]
public void CanRetrieveRecord()
{
var blogContext = new BlogContext(_builder.Options);
var blog1 = blogContext.Blogs.FirstOrDefault();
Assert.Contains("Development", blog1.Name);
}
The first test fail, the second pass. I am pretty sure the database has been created, that is why the second test passed, but why the first test fails?