Factory for constructing metrics publisher implementations using a IHystrixMetricsPublisher implementation provided by HystrixPlugins.
        public void MetricPublisherFactory_SingleInitializePerKey()
        {
            TestHystrixMetricsPublisher publisher = new TestHystrixMetricsPublisher();
            HystrixMetricsPublisherFactory factory = new HystrixMetricsPublisherFactory(publisher);
            List<Thread> threads = new List<Thread>();
            for (int i = 0; i < 20; i++)
            {
                threads.Add(new Thread(() =>
                {
                    factory.GetPublisherForCommand(CommandKeyForUnitTest.KeyOne, null, null, null, null);
                    factory.GetPublisherForCommand(CommandKeyForUnitTest.KeyTwo, null, null, null, null);
                    factory.GetPublisherForThreadPool(ThreadPoolKeyForUnitTest.ThreadPoolOne, null, null);
                }));
            }

            // start them
            foreach (Thread t in threads)
            {
                t.Start();
            }

            // wait for them to finish
            foreach (Thread t in threads)
            {
                t.Join();
            }

            // we should see 2 commands and 1 threadPool publisher created
            Assert.AreEqual(2, publisher.CommandCounter);
            Assert.AreEqual(1, publisher.ThreadCounter);
        }