コード例 #1
0
        private HardwareInformation GetCpuCoreCount()
        {
            var numOfCore    = wmiHelper.GetWmiValue <uint>("Win32_Processor", "NumberOfCores");
            var cpuCoreCount = new HardwareInformation()
            {
                MainValue  = (double)numOfCore,
                ShortName  = "CPU",
                UnitSymbol = (numOfCore > 1) ? "Cores" : "Core",
            };

            return(cpuCoreCount);
        }
コード例 #2
0
        public void GivenValidWmiPathAndKey_WhenRequestingData_ThenItReturnsProper()
        {
            double loadPercentage = wmiHelperSubject.GetWmiValue <double>("Win32_Processor", "LoadPercentage");

            Assert.True(loadPercentage > 0);
        }