public async Task TotalParts() { //Arrange var dbOptions = new DbContextOptionsBuilder <HyperCarsDbContext>() .UseInMemoryDatabase("HyperCarsDb") .Options; var db = new HyperCarsDbContext(dbOptions); var partService = new PartService(db); await db.SaveChangesAsync(); //Act var result = partService.Total(); //Assert result.Equals(db.Parts.CountAsync()); }