Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# unitTest wmi性能计数器_C#_Unit Testing_Wmi - Fatal编程技术网

C# unitTest wmi性能计数器

C# unitTest wmi性能计数器,c#,unit-testing,wmi,C#,Unit Testing,Wmi,我创建了PerformanceCounter,用于计算已处理项目的总数 PerformanceCounter pCo = new PerformanceCounter(CategoryName, CounterName, false); ... pCo.Increment(); 我想运行一个测试来检查计数器的输出 如何从WMI读取数据?关于stackoverflow,还有一个问题您可能会感兴趣 您可以创建模拟由性能计数器生成的数据的模拟 我有一个建议,我知道这违背了传统的想法:安装并允许性能计

我创建了PerformanceCounter,用于计算已处理项目的总数

PerformanceCounter pCo = new PerformanceCounter(CategoryName, CounterName, false);
...
pCo.Increment();
我想运行一个测试来检查计数器的输出


如何从WMI读取数据?

关于stackoverflow,还有一个问题您可能会感兴趣

您可以创建模拟由性能计数器生成的数据的模拟

我有一个建议,我知道这违背了传统的想法:安装并允许性能计数器作为单元测试的一部分运行,测试数据,并在单元测试清理期间卸载性能计数器。我没有明确地完成这项工作,但是我已经创建了单元测试,作为测试的一部分安装/卸载“某物”