Пример #1
0
        public void Value_is_called_value()
        {
            var monitor = new PerformanceCounterMonitor(MonitorConfig.Build("Test"),
                                                        PerformanceCounterConfig.Build("Process", "Private Bytes", Process.GetCurrentProcess().ProcessName));

            monitor.GetValues().Single().Name.Should().Be("value");
        }
Пример #2
0
        public void Performance_counter_consists_of_a_single_value()
        {
            var monitor = new PerformanceCounterMonitor(MonitorConfig.Build("Test"),
                                                        PerformanceCounterConfig.Build("Process", "Private Bytes", Process.GetCurrentProcess().ProcessName));

            monitor.GetValues().Should().HaveCount(1);
        }
Пример #3
0
        public void Performance_counter_with_instance_name()
        {
            var performanceCounter = new PerformanceCounter("Process", "Private Bytes", Process.GetCurrentProcess().ProcessName);

            var monitor = new PerformanceCounterMonitor(MonitorConfig.Build("Test"),
                                                        PerformanceCounterConfig.Build("Process", "Private Bytes", Process.GetCurrentProcess().ProcessName));

            monitor.GetValue()
            .Should()
            .BeGreaterThan(0)
            .And.BeApproximately(performanceCounter.NextValue(), 1000000,
                                 "Because memory usage can change between the two values");
        }
Пример #4
0
        public void Performance_counter_without_instance_name()
        {
            var performanceCounter = new PerformanceCounter("Memory", "Available Bytes");

            var monitor = new PerformanceCounterMonitor(MonitorConfig.Build("Test"),
                                                        PerformanceCounterConfig.Build("Memory", "Available Bytes"));

            monitor.GetValue()
            .Should()
            .BeGreaterThan(0)
            .And.BeApproximately(performanceCounter.NextValue(), 1000000,
                                 "Because memory usage can change between the two values");
        }
Пример #5
0
        public void Okanshimonitor_can_create_instance_with_tags()
        {
            PerformanceCounterMonitor p = OkanshiMonitor.PerformanceCounter(PerformanceCounterConfig.Build("Memory", "Available Bytes"), "name", new[] { new Tag("a", "b") });

            p.Should().NotBeNull();
        }
Пример #6
0
        public void Okanshimonitor_can_create_instance()
        {
            PerformanceCounterMonitor p = OkanshiMonitor.PerformanceCounter(PerformanceCounterConfig.Build("Memory", "Available Bytes"), "name");

            p.Should().NotBeNull();
        }