Пример #1
0
        public async Task PerformanceCounterTest()
        {
            var widget = new PerformanceCounter
            {
                CategoryName = "Memory",
                CounterName  = "Available MBytes",
            };

            var request = MetricQueryRequest.Create(widget);

            var handler = new PerformanceCounterQuery();

            await handler.Handle(request, CancellationToken.None).ConfigureAwait(false);

            Assert.AreEqual(State.Ok, widget.State);

            Assert.IsTrue(widget.Value > 0);
        }
Пример #2
0
        public async Task PerformanceCounter()
        {
            var http = new PerformanceCounter
            {
                CategoryName = "Memory",
                CounterName  = "Available MBytes",
            };

            var request = MetricQueryRequest.Create(http);

            var handler = new PerformanceCounterQuery();

            await handler.Handle(request, CancellationToken.None).ConfigureAwait(false);

            Assert.AreNotEqual(0, request.DataContext.Value);

            Assert.AreSame(State.Ok, request.DataContext.State);
        }