Exemplo n.º 1
0
        public void ParseErrorMultipleCounterLists()
        {
            CounterMonitor monitor            = new CounterMonitor();
            string         countersOptionText = "System.Runtime[cpu-usage][working-set],MyEventSource";
            var            e = Assert.Throws <CommandLineErrorException>(() => monitor.ConfigureCounters(countersOptionText, null));

            Assert.Equal("Error parsing --counters argument: Expected at most one '[' in counter_provider", e.Message);
        }
Exemplo n.º 2
0
        public void ParseErrorEmptyProvider()
        {
            CounterMonitor monitor            = new CounterMonitor();
            string         countersOptionText = ",MyEventSource";
            var            e = Assert.Throws <CommandLineErrorException>(() => monitor.ConfigureCounters(countersOptionText, null));

            Assert.Equal("Error parsing --counters argument: Expected non-empty counter_provider", e.Message);
        }
Exemplo n.º 3
0
        public void ParseErrorTrailingTextInCountersArg()
        {
            CounterMonitor monitor            = new CounterMonitor();
            string         countersOptionText = "System.Runtime[cpu-usage]hello,MyEventSource";
            var            e = Assert.Throws <CommandLineErrorException>(() => monitor.ConfigureCounters(countersOptionText, null));

            Assert.Equal("Error parsing --counters argument: Unexpected characters after closing ']' in counter_provider", e.Message);
        }
Exemplo n.º 4
0
        public void ParseErrorUnbalancedBracketsInCountersArg()
        {
            CounterMonitor monitor            = new CounterMonitor();
            string         countersOptionText = "System.Runtime[cpu-usage,MyEventSource";
            var            e = Assert.Throws <CommandLineErrorException>(() => monitor.ConfigureCounters(countersOptionText, null));

            Assert.Equal("Error parsing --counters argument: Expected to find closing ']' in counter_provider", e.Message);
        }
Exemplo n.º 5
0
        public void ParseErrorUnbalancedBracketsInCounterList()
        {
            CounterMonitor monitor                 = new CounterMonitor();
            string         countersOptionText      = "System.Runtime,MyEventSource";
            List <string>  commandLineProviderArgs = new List <string>()
            {
                "System.Runtime[cpu-usage", "MyEventSource"
            };
            var e = Assert.Throws <CommandLineErrorException>(() => monitor.ConfigureCounters(countersOptionText, commandLineProviderArgs));

            Assert.Equal("Error parsing counter_list: Expected to find closing ']' in counter_provider", e.Message);
        }
Exemplo n.º 6
0
        public void GenerateCounterListWithOptionAndArgumentsTestWithDupEntries()
        {
            CounterMonitor monitor = new CounterMonitor();
            List <string>  commandLineProviderArgs = new List <string>()
            {
                "System.Runtime", "MyEventSource"
            };
            string     countersOptionText = "System.Runtime,MyEventSource";
            CounterSet counters           = monitor.ConfigureCounters(countersOptionText, commandLineProviderArgs);

            Assert.Equal(2, counters.Providers.Count());
            Assert.Contains("MyEventSource", counters.Providers);
            Assert.Contains("System.Runtime", counters.Providers);
        }