public async Task PaymentAllTest() { var optionBuilder = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase("testDb"); var dbContext = new ApplicationDbContext(optionBuilder.Options); var service = new PaymentsService(dbContext); var payment = new Payment { Date = DateTime.UtcNow.Date, PaymentSource = Enum.Parse <PaymentSource>("каса"), Value = 100 }; await dbContext.Payments.AddAsync(payment); await dbContext.SaveChangesAsync(); // Act var result = service.AllAsync(); // Assert Assert.NotNull(result); //Assert.Equal(1, result.Id); }