Exemplo n.º 1
0
        private Connection GetConnection(ConfigurationRawData configuration)
        {
            var url = configuration?.Url ?? string.Empty;

            if (Connections.TryGetValue(url, out var connection))
            {
                return(connection);
            }

            connection = new Connection(url);
            Connections.Add(url, connection);
            return(connection);
        }
Exemplo n.º 2
0
        private async Task <ConnectionTestResult> TestConnection(ConfigurationRawData data)
        {
            try
            {
                var connection            = GetConnection(data);
                var buildProvider         = new BuildProvider(connection);
                var definitionsEnumerable = buildProvider.FetchExistingBuildDefinitions();
                await foreach (var _ in definitionsEnumerable)
                {
                    return(ConnectionTestResult.Success);
                }
            }
            catch (Exception ex)
            {
                return(ConnectionTestResult.Failure(ex.Message));
            }

            return(ConnectionTestResult.Success);
        }