public void FindPersonShoudNotWork() { var options = new DbContextOptionsBuilder <AppDbContext>() .UseInMemoryDatabase(databaseName: "nmicrosinterviewfindonenotwork") .Options; // Insert seed data into the database using one instance of the context using (var context = new AppDbContext(options)) { context.Person.Add(new Person { Id = 1, FName = "Fname1", LName = "Lame1" }); context.SaveChanges(); } // Use a clean instance of the context to run the test using (var context = new AppDbContext(options)) { PersonController personController = new PersonController(context); Person person = personController.FindPerson(2); Assert.Null(person); } }