public void set_url_throw_exception_if_url_proxy_is_not_valid_uri()
        {
            _proxy = new JsonRpcClientProxy(_client, null, LimboLogs.Instance);
            Action act = () => _proxy.SetUrls("http:/localhost");

            act.Should().Throw <UriFormatException>();
        }
Example #2
0
        public async Task SetAsync(IEnumerable <string> urls)
        {
            var providedUrls = urls?.ToArray() ?? Array.Empty <string>();

            _jsonRpcClientProxy?.SetUrls(providedUrls);
            NdmConfig?config = await _configManager.GetAsync(_configId);

            if (config == null)
            {
                if (_logger.IsError)
                {
                    _logger.Error($"Failed to retrieve config {_configId} to update JSON RPC procy");
                }
                throw new InvalidOperationException($"Failed to retrieve config {_configId} to update JSON RPC procy");
            }
            else
            {
                config.JsonRpcUrlProxies = providedUrls;
                await _configManager.UpdateAsync(config);

                if (_logger.IsInfo)
                {
                    _logger.Info("Updated JSON RPC Proxy configuration.");
                }
            }
        }
Example #3
0
        public async Task SetAsync(IEnumerable <string> urls)
        {
            var providedUrls = urls?.ToArray() ?? Array.Empty <string>();

            _jsonRpcClientProxy?.SetUrls(providedUrls);
            var config = await _configManager.GetAsync(_configId);

            config.JsonRpcUrlProxies = providedUrls;
            await _configManager.UpdateAsync(config);

            if (_logger.IsInfo)
            {
                _logger.Info("Updated JSON RPC Proxy configuration.");
            }
        }
 public void set_url_should_succeed_when_url_is_empty()
 {
     _proxy = new JsonRpcClientProxy(_client, null, LimboLogs.Instance);
     _proxy.SetUrls(null);
 }