public async Task AllDeliveredAsyncShouldReturnOnlyDeliveredPackages() { var db = DbInfrastructure.GetDatabase(); var mockUserManager = this.GetUserManagerMock(); mockUserManager .Setup(m => m.FindByIdAsync(It.IsAny <string>())) .Returns((string id) => db.Users.SingleOrDefaultAsync(u => u.Id == id)); var receiptService = new Mock <IReceiptService>().Object; var packageService = new PackageService(db, receiptService, mockUserManager.Object); await AddPackagesToDb(db); var delivered = await packageService.AllDeliveredAsync(); delivered .Should() .HaveCount(20); }