Example #1
0
        public async Task DeckDoesNotExist()
        {
            var db   = DbHelper.GetEmptyTestDB();
            var user = await UserHelper.CreateInDbAsync(db);

            using var dbContext = new MemCheckDbContext(db);
            var request = new DeleteDeck.Request(user, Guid.NewGuid());
            await Assert.ThrowsExceptionAsync <InvalidOperationException>(async() => await new DeleteDeck(dbContext.AsCallContext()).RunAsync(request));
        }
Example #2
0
        public async Task UserNotLoggedIn()
        {
            var db   = DbHelper.GetEmptyTestDB();
            var user = await UserHelper.CreateInDbAsync(db);

            var deck = await DeckHelper.CreateAsync(db, user);

            using var dbContext = new MemCheckDbContext(db);
            var request = new DeleteDeck.Request(Guid.Empty, deck);
            await Assert.ThrowsExceptionAsync <InvalidOperationException>(async() => await new DeleteDeck(dbContext.AsCallContext()).RunAsync(request));
        }
Example #3
0
        public async Task Success()
        {
            var db   = DbHelper.GetEmptyTestDB();
            var user = await UserHelper.CreateInDbAsync(db);

            var deck = await DeckHelper.CreateAsync(db, user);

            var otherDeck = await DeckHelper.CreateAsync(db, user);

            var request = new DeleteDeck.Request(user, deck);

            using (var dbContext = new MemCheckDbContext(db))
                await new DeleteDeck(dbContext.AsCallContext()).RunAsync(request);

            using (var dbContext = new MemCheckDbContext(db))
            {
                Assert.IsFalse(await dbContext.Decks.AnyAsync(d => d.Id == deck));
                Assert.IsTrue(await dbContext.Decks.AnyAsync(d => d.Id == otherDeck));
            }
        }