public async Task AllShouldReturnEnginesCorrectly() { var options = new DbContextOptionsBuilder <NeedForCarsDbContext>() .UseInMemoryDatabase("AllEnginesDb") .Options; var context = new NeedForCarsDbContext(options); var enginesService = new EnginesService(context); var engine1 = new Engine { Name = "Name1", FuelType = Models.Enums.FuelType.Diesel, MaxHP = 100, Creator = "Creator" }; await context.AddAsync(engine1); var engine2 = new Engine { Name = "Name2", FuelType = Models.Enums.FuelType.Diesel, MaxHP = 100, Creator = "Creator" }; await context.AddAsync(engine2); await context.SaveChangesAsync(); var result = enginesService.All().Count(); Assert.Equal(2, result); }