public void IncrementsMultipleInstancesIndependently()
        {
            string firstInstanceName  = "first";
            string secondInstanceName = "second";

            FixedPrefixNameFormatter formatter = new FixedPrefixNameFormatter("Baz - ");

            var connectionOpenedCounter = new EnterpriseLibraryPerformanceCounter(
                NewDataInstrumentationProvider.CounterCategoryName,
                NewDataInstrumentationProvider.TotalConnectionOpenedCounter,
                formatter.CreateName(firstInstanceName),
                formatter.CreateName(secondInstanceName));

            var firstProvider  = new NewDataInstrumentationProvider(firstInstanceName, true, true, formatter);
            var secondProvider = new NewDataInstrumentationProvider(secondInstanceName, true, true, formatter);

            firstProvider.FireConnectionOpenedEvent();

            Assert.AreEqual(1, connectionOpenedCounter.GetValueFor(formatter.CreateName(firstInstanceName)));
            Assert.AreEqual(0, connectionOpenedCounter.GetValueFor(formatter.CreateName(secondInstanceName)));

            secondProvider.FireConnectionOpenedEvent();

            Assert.AreEqual(1, connectionOpenedCounter.GetValueFor(formatter.CreateName(firstInstanceName)));
            Assert.AreEqual(1, connectionOpenedCounter.GetValueFor(formatter.CreateName(secondInstanceName)));
        }
        public void IncrementsMultipleInstancesIndependently()
        {
            string firstInstanceName = "first";
            string secondInstanceName = "second";

            FixedPrefixNameFormatter formatter = new FixedPrefixNameFormatter("Baz - ");

            var connectionOpenedCounter = new EnterpriseLibraryPerformanceCounter(
                NewDataInstrumentationProvider.CounterCategoryName,
                NewDataInstrumentationProvider.TotalConnectionOpenedCounter,
                formatter.CreateName(firstInstanceName),
                formatter.CreateName(secondInstanceName));

            var firstProvider = new NewDataInstrumentationProvider(firstInstanceName, true, true, formatter);
            var secondProvider = new NewDataInstrumentationProvider(secondInstanceName, true, true, formatter);

            firstProvider.FireConnectionOpenedEvent();

            Assert.AreEqual(1, connectionOpenedCounter.GetValueFor(formatter.CreateName(firstInstanceName)));
            Assert.AreEqual(0, connectionOpenedCounter.GetValueFor(formatter.CreateName(secondInstanceName)));

            secondProvider.FireConnectionOpenedEvent();

            Assert.AreEqual(1, connectionOpenedCounter.GetValueFor(formatter.CreateName(firstInstanceName)));
            Assert.AreEqual(1, connectionOpenedCounter.GetValueFor(formatter.CreateName(secondInstanceName)));
        }
        public void TotalConnectionOpenedCounterIncremented()
        {
            provider.FireConnectionOpenedEvent();

            Assert.AreEqual(1, totalConnectionOpenedCounter.Value);
        }