public void IgnoreNegativeWithdraws(int bits)
        {
            int balance = _bank.Deposit(_user, 100);

            (int result, int withdrawn) = _bank.Withdraw(_user, bits);

            result.Should().Be(balance);
            withdrawn.Should().Be(0);
        }
Ejemplo n.º 2
0
        public GilTransaction ProcessPayment(CommandData commandData, int amount, bool canModsOverride)
        {
            if (_unlocked && commandData.User.IsDevChatter)
            {
                return(new GilTransaction(true, 0));
            }

            int  gilSpent     = 0;
            bool requiresBits = !commandData.User.IsBroadcaster &&
                                !commandData.User.IsMe &&
                                (!canModsOverride || !commandData.User.IsMod);

            if (requiresBits)
            {
                (_, gilSpent) = _gilBank.Withdraw(commandData.User, amount, true);
                if (gilSpent < amount)
                {
                    _twitchClient.SendMessage(commandData.Channel,
                                              $"Sorry, '!{commandData.CommandText}' has a minimum gil cost of {amount}. Cheer for gil.");
                    return(new GilTransaction(false, gilSpent));
                }
            }

            return(new GilTransaction(true, gilSpent));
        }