public async void ListKeysAsync_ReturnsActiveKeys() { //Arrange var options = InMemoryUtils.ProduceFreshDbContextOptions(); using (var context = new ApplicationDbContext(options)) { context.Resources.Add(ResourceUtils.TestSet.First()); context.SaveChanges(); } //Act using (var context = new ApplicationDbContext(options)) { IActEntityRepository <Resource, int, ApplicationUser, string> repo = new ResourcesRepository(context); var result = await repo.ListActiveKeysAsync(); //Assert Assert.NotEmpty(result); Assert.IsAssignableFrom <IEnumerable <int> >(result); Assert.Single(result); } }