public async Task AccountRequestRateLimitTest(KeyPair clientKeyPair, int?requestLimit)
        {
            context.AppState.State = ApplicationState.Ready;

            var account = context.AccountStorage.GetAccount(clientKeyPair);

            if (requestLimit.HasValue)
            {
                //TODO: replace it with quantum
                var effect = new RequestRateLimitUpdateEffect
                {
                    Account           = account.Id,
                    AccountWrapper    = account,
                    RequestRateLimits = new RequestRateLimits
                    {
                        HourLimit   = (uint)requestLimit.Value,
                        MinuteLimit = (uint)requestLimit.Value
                    }
                };
                var effectProcessor = new RequestRateLimitUpdateEffectProcessor(effect, context.Constellation.RequestRateLimits);
                effectProcessor.CommitEffect();
            }
            var clientConnection = new AlphaWebSocketConnection(context, new FakeWebSocket(), "127.0.0.1")
            {
                ClientPubKey    = clientKeyPair,
                ConnectionState = ConnectionState.Ready,
                Account         = account
            };

            var minuteLimit     = (account.Account.RequestRateLimits ?? context.Constellation.RequestRateLimits).MinuteLimit;
            var minuteIterCount = minuteLimit + 1;

            for (var i = 0; i < minuteIterCount; i++)
            {
                var envelope = new AccountDataRequest
                {
                    Account   = account.Account.Id,
                    RequestId = i + 1
                }.CreateEnvelope();
                envelope.Sign(clientKeyPair);
                using var writer = new XdrBufferWriter();
                var inMessage = envelope.ToIncomingMessage(writer);
                if (i + 1 > minuteLimit)
                {
                    await AssertMessageHandling(clientConnection, inMessage, typeof(TooManyRequestsException));
                }
                else
                {
                    await AssertMessageHandling(clientConnection, inMessage);
                }
            }
        }
        public async Task AccountDataRequestTest(ConnectionState state, Type excpectedException)
        {
            context.AppState.State = ApplicationState.Ready;

            var clientConnection = new AlphaWebSocketConnection(context, new FakeWebSocket(), "127.0.0.1")
            {
                ClientPubKey    = TestEnvironment.Client1KeyPair.PublicKey,
                ConnectionState = state
            };

            var account = context.AccountStorage.GetAccount(TestEnvironment.Client1KeyPair);

            var envelope = new AccountDataRequest
            {
                Account   = account.Account.Id,
                RequestId = 1
            }.CreateEnvelope();

            envelope.Sign(TestEnvironment.Client1KeyPair);
            using var writer = new XdrBufferWriter();
            var inMessage = envelope.ToIncomingMessage(writer);

            await AssertMessageHandling(clientConnection, inMessage, excpectedException);
        }