public async Task TestWithdrawInsufficientFunds() { var dbContext = TestUtils.CreateDatabase(); try { var user = dbContext.TwitchQuery(_configuration["Config:TestFromUserId"]).FirstOrDefault(); var amount = user.UserWallet.Balance.Value + 10; var server = dbContext.WalletServer.FirstOrDefault(u => u.Index == user.UserWallet.WalletServer); await WalletUtils.DebitWithdrawTx("test", user, server, amount, dbContext, "test"); using (var dbContext2 = TestUtils.CreateDatabase()) { var user2 = dbContext2.TwitchQuery(_configuration["Config:TestFromUserId"]).FirstOrDefault(); var server2 = dbContext2.WalletServer.FirstOrDefault(u => u.Index == user.UserWallet.WalletServer); Assert.Equal(user.UserWallet.Balance, user2.UserWallet.Balance); Assert.Equal(server.ServerBalance, server2.ServerBalance); } } finally { dbContext.Dispose(); } }