public void GetSystemInfo_ResultIsNotNull()
        {
            // Arrange
            ITimeProvider timeProvider = new UTCTimeProvider();
            IMachineNameProvider machineNameProvider = new EnvironmentMachineNameProvider();

            var agentControlDefinitionProvider = new Mock<IAgentControlDefinitionProvider>();
            var agentControlDefinition = new AgentControlDefinition { AgentIsEnabled = true, CheckIntervalInSeconds = 60 };
            agentControlDefinitionProvider.Setup(a => a.GetControlDefinition()).Returns(agentControlDefinition);

            IProcessorStatusProvider processorStatusProvider = new ProcessorStatusProvider();
            IMemoryUnitConverter memoryUnitConverter = new MemoryUnitConverter();
            ISystemMemoryStatusProvider systemMemoryStatusProvider = new SystemMemoryStatusProvider(memoryUnitConverter);
            ILogicalDiscInstanceNameProvider logicalDiscInstanceNameProvider = new LogicalDiscInstanceNameProvider();
            ISystemStorageStatusProvider systemStorageStatusProvider = new SystemStorageStatusProvider(logicalDiscInstanceNameProvider);
            ISystemPerformanceDataProvider systemPerformanceDataProvider = new SystemPerformanceDataProvider(
                agentControlDefinitionProvider.Object, processorStatusProvider, systemMemoryStatusProvider, systemStorageStatusProvider);

            var httpStatusCodeFetcher = new Mock<IHttpStatusCodeFetcher>();

            IHttpStatusCodeCheckResultProvider httpStatusCodeCheckResultProvider = new HttpStatusCodeCheckResultProvider(
                agentControlDefinitionProvider.Object, httpStatusCodeFetcher.Object);

            var systemInformationProvider = new SystemInformationProvider(
                timeProvider, machineNameProvider, systemPerformanceDataProvider, httpStatusCodeCheckResultProvider);

            // Act
            var result = systemInformationProvider.GetSystemInfo();

            // Assert
            Assert.IsNotNull(result);
        }
        public void GetProcessorUtilizationInPercent()
        {
            // Arrange
            var processorStatusProvider = new ProcessorStatusProvider();

            // Act
            var result = processorStatusProvider.GetProcessorStatus();

            // Assert
            Assert.IsNotNull(result);
        }
        public void GetProcessorUtilizationInPercent_Every10Milliseconds_For5Seconds()
        {
            // Arrange
            int durationInMilliseconds = 5 * 1000;
            int waitPeriodInMilliseconds = 100;
            int timeWaited = 0;
            var values = new List<double>();

            // Act
            using (var processorStatusProvider = new ProcessorStatusProvider())
            {
                do
                {
                    values.Add(processorStatusProvider.GetProcessorStatus().ProcessorUtilizationInPercent);
                    Thread.Sleep(waitPeriodInMilliseconds);
                    timeWaited += waitPeriodInMilliseconds;
                }
                while (timeWaited <= durationInMilliseconds);
            }

            // Assert
            Assert.AreNotEqual(0d, values.Average());
        }