예제 #1
0
        public async Task AllPendingAsyncShouldReturnOnlyPendingPackages()
        {
            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 pending = await packageService.AllPendingAsync();

            pending
            .Should()
            .HaveCount(10);
        }