コード例 #1
0
        internal static IWebHookFilterManager CreateWebHookFilterManager(int providerCount)
        {
            var providerMocks = new Mock <IWebHookFilterProvider> [providerCount];

            for (var i = 0; i < providerMocks.Length; i++)
            {
                providerMocks[i] = CreateFilterProvider(i);
            }
            var manager = new WebHookFilterManager(providerMocks.Select(p => p.Object));

            return(manager);
        }
コード例 #2
0
ファイル: CustomServices.cs プロジェクト: yingjin-us/WebHooks
        /// <summary>
        /// Gets a default <see cref="IWebHookFilterManager"/> implementation which is used if none are registered with the
        /// Dependency Injection engine.
        /// </summary>
        /// <param name="filterProviders">The collection of <see cref="IWebHookFilterProvider"/> instances to use.</param>
        /// <returns>A default <see cref="IWebHookFilterManager"/> instance.</returns>
        public static IWebHookFilterManager GetFilterManager(IEnumerable <IWebHookFilterProvider> filterProviders)
        {
            if (_filterManager != null)
            {
                return(_filterManager);
            }

            if (filterProviders == null)
            {
                throw new ArgumentNullException(nameof(filterProviders));
            }

            IWebHookFilterManager instance = new WebHookFilterManager(filterProviders);

            Interlocked.CompareExchange(ref _filterManager, instance, null);
            return(_filterManager);
        }
コード例 #3
0
ファイル: CustomServices.cs プロジェクト: itomek/WebHooks
        /// <summary>
        /// Gets a default <see cref="IWebHookFilterManager"/> implementation which is used if none are registered with the
        /// Dependency Injection engine.
        /// </summary>
        /// <param name="filterProviders">The collection of <see cref="IWebHookFilterProvider"/> instances to use.</param>
        /// <returns>A default <see cref="IWebHookFilterManager"/> instance.</returns>
        public static IWebHookFilterManager GetFilterManager(IEnumerable<IWebHookFilterProvider> filterProviders)
        {
            if (_filterManager != null)
            {
                return _filterManager;
            }

            if (filterProviders == null)
            {
                throw new ArgumentNullException("filterProviders");
            }

            IWebHookFilterManager instance = new WebHookFilterManager(filterProviders);
            Interlocked.CompareExchange(ref _filterManager, instance, null);
            return _filterManager;
        }