public async Task PatientRepositroyAddPatientTest() { var testModel = new PatientModel() { Id = new Guid(), FirstName = "John", LastName = "Hu", Gender = Gender.male, DateOfBirth = new DateTime(1992, 2, 14), Email = "*****@*****.**", Phone = "0425789632", CreateTime = DateTime.Now, UpdateTime = DateTime.Now, }; using (var context = new PatientDbContext(dbOptionsBuilder.Options)) { var dbContext = new PatientDbContext(dbOptionsBuilder.Options); var repo = new PatientRepository(dbContext); var result = await repo.AddPatientAsync(testModel); repo.SaveChanges(); Assert.AreNotEqual(0, context.Patients.Select(q => q.Id == testModel.Id).Count()); } }