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 Constructor_AllParametersAreSet_ObjectIsInstantiated() { // Arrange var memoryUnitConverter = new Mock<IMemoryUnitConverter>(); // Act var systemMemoryStatusProvider = new SystemMemoryStatusProvider(memoryUnitConverter.Object); // Assert Assert.IsNotNull(systemMemoryStatusProvider); }
public void GetMemoryStatus() { // Arrange var memoryUnitConverter = new MemoryUnitConverter(); var systemMemoryStatusProvider = new SystemMemoryStatusProvider(memoryUnitConverter); // Act var result = systemMemoryStatusProvider.GetMemoryStatus(); // Assert Assert.AreNotEqual(0d, result.AvailableMemoryInGB); Assert.AreNotEqual(0d, result.UsedMemoryInGB); }