public async Task GetDrinkByIdAsyncTestAsync() { var options = new DbContextOptionsBuilder <CoffeeDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; using (var context = new CoffeeDbContext(options)) { var newDrink = new Drink { DrinkName = "test", Description = "test", Price = 100, CategoryId = 1, Category = new Category() }; var service = new DrinkRepository(context); await service.AddDrinkAsync(newDrink); } using (var context = new CoffeeDbContext(options)) { var newDrink = new Drink { Id = 1, DrinkName = "test", Description = "test", Price = 100, CategoryId = 1, Category = new Category() }; var service = new DrinkRepository(context); var result = await service.GetDrinkByIdAsync(1); Assert.AreEqual(1, context.Drinks.Count()); Assert.AreEqual(newDrink.Id, result.Id); } }