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)); }
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)); }
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)); } }