public IEnumerable <ClientAndServerProvider> GetSupportedProviders(TestContext ctx, string filter)
        {
            string clientFilter, serverFilter;

            if (filter == null)
            {
                clientFilter = serverFilter = null;
            }
            else
            {
                int pos = filter.IndexOf(':');
                if (pos < 0)
                {
                    clientFilter = serverFilter = filter;
                }
                else
                {
                    clientFilter = filter.Substring(0, pos);
                    serverFilter = filter.Substring(pos + 1);
                }
            }

            var factory = DependencyInjector.Get <ConnectionProviderFactory> ();

            var clientProviders = factory.GetProviders(p => IsClientSupported(ctx, p, clientFilter));
            var serverProviders = factory.GetProviders(p => IsServerSupported(ctx, p, serverFilter));

            return(ConnectionTestHelper.Join(clientProviders, serverProviders, (c, s) => {
                return Create(c, s);
            }));
        }
示例#2
0
        public IEnumerable <ClientAndServerProvider> GetSupportedProviders(TestContext ctx, string filter)
        {
            string clientFilter, serverFilter;

            if (filter == null)
            {
                clientFilter = serverFilter = null;
            }
            else
            {
                int pos = filter.IndexOf(':');
                if (pos < 0)
                {
                    clientFilter = serverFilter = filter;
                }
                else
                {
                    clientFilter = filter.Substring(0, pos);
                    serverFilter = filter.Substring(pos + 1);
                }
            }

            var factory   = DependencyInjector.Get <ConnectionProviderFactory> ();
            var providers = factory.GetProviders(p => IsSupported(p)).ToList();

            if (providers.Count == 0)
            {
                return(new ClientAndServerProvider[0]);
            }

            var supportedClientProviders = providers.Where(p => IsClientSupported(p)).ToList();
            var supportedServerProviders = providers.Where(p => IsServerSupported(p)).ToList();

            if (supportedClientProviders.Count == 0 || supportedServerProviders.Count == 0)
            {
                return(new ClientAndServerProvider[0]);
            }

            var filteredClientProviders = supportedClientProviders.Where(p => IsSupported(ctx, p, clientFilter)).ToList();
            var filteredServerProviders = supportedServerProviders.Where(p => IsSupported(ctx, p, serverFilter)).ToList();

            if (filter != null)
            {
                if (filteredClientProviders.Count == 0)
                {
                    ctx.LogMessage($"WARNING: No TLS Provider matches client filter '{clientFilter}'");
                }
                if (filteredServerProviders.Count == 0)
                {
                    ctx.LogMessage($"WARNING: No TLS Provider matches server filter '{serverFilter}'");
                }
            }

            return(ConnectionTestHelper.Join(filteredClientProviders, filteredServerProviders, (c, s) => {
                return Create(c, s);
            }));
        }