public void ReadACounterWithouAnInstance() { var reader = new Reader(new CounterDefinition { CategoryName = "Memory", CounterName = "Available MBytes", InstanceName = string.Empty }, new DefaultMachineNameProvider(), new DefaultCounterIdentifierGenerator()); reader.Read(new[] { Sink }).Wait(); Assert.Equal(1, SentValues.Count); Assert.True( SentValues[0]>0); Thread.Sleep(200); reader.Read(new[] { Sink }).Wait(); Assert.Equal(2, SentValues.Count); Assert.True(SentValues[0] > 0); }
public void ReadACounter() { var reader = new Reader(new CounterDefinition { CategoryName = "Processor", CounterName = "% Processor Time", InstanceName = "_Total" }, new DefaultMachineNameProvider(), new DefaultCounterIdentifierGenerator()); reader.Read(new[] {Sink}).Wait(); Assert.Equal(1, SentValues.Count); Assert.Equal(0, SentValues[0]); Thread.Sleep(200); reader.Read(new[] {Sink}).Wait(); Assert.Equal(2, SentValues.Count); Assert.True(SentValues[1] > 0); }