Пример #1
0
        public async Task AllShippedAsyncShouldReturnOnlyShippedPackages()
        {
            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 shipped = await packageService.AllShippedAsync();

            shipped
            .Should()
            .HaveCount(30);
        }