public async Task DeleteAsyncShouldDeleteEngine() { var options = new DbContextOptionsBuilder <NeedForCarsDbContext>() .UseInMemoryDatabase("DeleteEngineDb") .Options; var context = new NeedForCarsDbContext(options); var enginesService = new EnginesService(context); var engine = new Engine { Name = "Name1", FuelType = Models.Enums.FuelType.Diesel, MaxHP = 100, Creator = "Creator" }; await context.Engines.AddAsync(engine); await context.SaveChangesAsync(); await enginesService.DeleteAsync(engine); var result = await context.Engines.CountAsync(); Assert.Equal(0, result); }