Example #1
0
            public void TheStartMethodWithoutAnyExceptions()
            {
                // This may NOT throw any exceptions!!!
                StatisticsComponentProxy componentProxy = StatisticsComponentProxy.Instance;

                componentProxy.Start();
            }
Example #2
0
            public void IncrementWithCustomStepSize()
            {
                // This may NOT throw any exceptions!!!
                StatisticsComponentProxy componentProxy = StatisticsComponentProxy.Instance;

                componentProxy.Start();

                for (int i = 0; i < 100; i++)
                {
                    componentProxy.IncrementCounter(CounterIds.ActiveRuleDefinitions, 10);
                }
                for (int i = 0; i < 100; i++)
                {
                    componentProxy.IncrementCounter(CounterIds.CategoryDeclarations, 10);
                }
                for (int i = 0; i < 100; i++)
                {
                    componentProxy.IncrementCounter(CounterIds.CriticalMatches, 10);
                }
                for (int i = 0; i < 100; i++)
                {
                    componentProxy.IncrementCounter(CounterIds.FatalMatches, 10);
                }
                for (int i = 0; i < 100; i++)
                {
                    componentProxy.IncrementCounter(CounterIds.Files, 10);
                }
                for (int i = 0; i < 100; i++)
                {
                    componentProxy.IncrementCounter(CounterIds.InfoMatches, 10);
                }
                for (int i = 0; i < 100; i++)
                {
                    componentProxy.IncrementCounter(CounterIds.RuleDeclarations, 10);
                }
                for (int i = 0; i < 100; i++)
                {
                    componentProxy.IncrementCounter(CounterIds.WarningMatches, 10);
                }

                Assert.AreEqual(1000, componentProxy.ReadCounter(CounterIds.ActiveRuleDefinitions), 0);
                Assert.AreEqual(1000, componentProxy.ReadCounter(CounterIds.CategoryDeclarations), 0);
                Assert.AreEqual(1000, componentProxy.ReadCounter(CounterIds.CriticalMatches), 0);
                Assert.AreEqual(1000, componentProxy.ReadCounter(CounterIds.FatalMatches), 0);
                Assert.AreEqual(1000, componentProxy.ReadCounter(CounterIds.Files), 0);
                Assert.AreEqual(1000, componentProxy.ReadCounter(CounterIds.InfoMatches), 0);
                Assert.AreEqual(1000, componentProxy.ReadCounter(CounterIds.RuleDeclarations), 0);
                Assert.AreEqual(1000, componentProxy.ReadCounter(CounterIds.WarningMatches), 0);
            }