public async Task BookAppointmentAsync_WithValidId_ShouldMakeAppointmentStatusBooked() { var options = new DbContextOptionsBuilder <DentHubContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()) // Give a Unique name to the DB .Options; var dbContext = new DentHubContext(options); var repository = new DbRepository <Appointment>(dbContext); var ratingRepository = new DbRepository <Rating>(dbContext); var service = new AppointmentService(repository, ratingRepository); var user = new DentHubUser() { Id = "1", SSN = "123456", FirstName = "Test", LastName = "Patient", }; var appointment = new Appointment { Id = 20, ClinicId = 1, DentistID = "1", PatientId = null, Status = Status.Offering, }; dbContext.Appointments.Add(appointment); dbContext.DentHubUsers.Add(user); await dbContext.SaveChangesAsync(); await service .BookAppointmentAsync(20, user); var result = dbContext.Appointments .FirstOrDefaultAsync(a => a.Id == 20) .GetAwaiter() .GetResult(); Assert.Equal("Booked", result .Status .ToString()); Assert.Equal("1", result .PatientId); }