public void Constructor_AllParametersAreSet_ObjectIsInstantiated()
        {
            // Arrage
            var processorStatusOrchestrator = new Mock<IProcessorStatusOrchestrator>();
            var memoryStatusOrchestrator = new Mock<IMemoryStatusOrchestrator>();
            var storageStatusOrchestrator = new Mock<IStorageStatusOrchestrator>();

            // Act
            var systemStatusOrchestrator = new SystemStatusOrchestrator(
                processorStatusOrchestrator.Object, memoryStatusOrchestrator.Object, storageStatusOrchestrator.Object);

            // Assert
            Assert.IsNotNull(systemStatusOrchestrator);
        }
        public void GetSystemStatusViewModel_ParameterIsNull_ArgumentNullExceptionIsThrown()
        {
            // Arrage
            SystemInformation sytemInformation = null;

            var processorStatusOrchestrator = new Mock<IProcessorStatusOrchestrator>();
            var memoryStatusOrchestrator = new Mock<IMemoryStatusOrchestrator>();
            var storageStatusOrchestrator = new Mock<IStorageStatusOrchestrator>();

            var systemStatusOrchestrator = new SystemStatusOrchestrator(
                processorStatusOrchestrator.Object, memoryStatusOrchestrator.Object, storageStatusOrchestrator.Object);

            // Act
            systemStatusOrchestrator.GetSystemStatusViewModel(sytemInformation);
        }
        public void GetSystemStatusViewModel_MemoryStatusIsNotNull_ResultContainsMemoryStatusDataPoint()
        {
            // Arrage
            var memoryStatus = new SystemMemoryInformation { UsedMemoryInGB = 1d, AvailableMemoryInGB = 10d };
            var systemPerformanceInformation = new SystemPerformanceData { MemoryStatus = memoryStatus };
            var systemInformation = new SystemInformation { SystemPerformance = systemPerformanceInformation };
            var memoryStatusViewModel = new SystemStatusPointViewModel { Name = "Memory Status", Value = 10d };

            var processorStatusOrchestrator = new Mock<IProcessorStatusOrchestrator>();
            var memoryStatusOrchestrator = new Mock<IMemoryStatusOrchestrator>();
            memoryStatusOrchestrator.Setup(p => p.GetMemoryUtilizationInPercent(It.IsAny<SystemMemoryInformation>())).Returns(memoryStatusViewModel);

            var storageStatusOrchestrator = new Mock<IStorageStatusOrchestrator>();

            var systemStatusOrchestrator = new SystemStatusOrchestrator(
                processorStatusOrchestrator.Object, memoryStatusOrchestrator.Object, storageStatusOrchestrator.Object);

            // Act
            var result = systemStatusOrchestrator.GetSystemStatusViewModel(systemInformation);

            // Assert
            Assert.AreEqual(memoryStatusViewModel.Value, result.DataPoints.First(d => d.Name.Equals(memoryStatusViewModel.Name)).Value);
        }
        public void GetSystemStatusViewModel_StorageStatusIsNotNull_ResultContainsStorageStatusDataPoint()
        {
            // Arrage
            var deviceInfo1 = new SystemStorageDeviceInformation { DeviceName = "C:", FreeDiscSpaceInPercent = 20d };
            var deviceInfos = new[] { deviceInfo1 };
            var storageStatus = new SystemStorageInformation { StorageDeviceInfos = deviceInfos };
            var systemPerformanceInformation = new SystemPerformanceData { StorageStatus = storageStatus };
            var systemInformation = new SystemInformation { SystemPerformance = systemPerformanceInformation };
            var storageStatusViewModel = new SystemStatusPointViewModel { Name = "Storage Status" + deviceInfo1.DeviceName, Value = deviceInfo1.FreeDiscSpaceInPercent };

            var processorStatusOrchestrator = new Mock<IProcessorStatusOrchestrator>();
            var memoryStatusOrchestrator = new Mock<IMemoryStatusOrchestrator>();
            var storageStatusOrchestrator = new Mock<IStorageStatusOrchestrator>();
            storageStatusOrchestrator.Setup(s => s.GetStorageUtilizationInPercent(It.IsAny<SystemStorageInformation>())).Returns(
                new[] { storageStatusViewModel });

            var systemStatusOrchestrator = new SystemStatusOrchestrator(
                processorStatusOrchestrator.Object, memoryStatusOrchestrator.Object, storageStatusOrchestrator.Object);

            // Act
            var result = systemStatusOrchestrator.GetSystemStatusViewModel(systemInformation);

            // Assert
            Assert.AreEqual(storageStatusViewModel.Value, result.DataPoints.First(d => d.Name.Equals(storageStatusViewModel.Name)).Value);
        }
        public void GetSystemStatusViewModel_ParameterIsValid_SystemStatusViewModelContainsSuppliedTimestamp()
        {
            // Arrage
            var timestamp = DateTime.UtcNow;
            var sytemInformation = new SystemInformation { Timestamp = timestamp };

            var processorStatusOrchestrator = new Mock<IProcessorStatusOrchestrator>();
            var memoryStatusOrchestrator = new Mock<IMemoryStatusOrchestrator>();
            var storageStatusOrchestrator = new Mock<IStorageStatusOrchestrator>();

            var systemStatusOrchestrator = new SystemStatusOrchestrator(
                processorStatusOrchestrator.Object, memoryStatusOrchestrator.Object, storageStatusOrchestrator.Object);

            // Act
            var result = systemStatusOrchestrator.GetSystemStatusViewModel(sytemInformation);

            // Assert
            Assert.AreEqual(timestamp, result.Timestamp);
        }
        public void GetSystemStatusViewModel_ParameterIsValid_SystemStatusViewModelContainsSuppliedMachineName(string machineName)
        {
            // Arrage
            var sytemInformation = new SystemInformation { MachineName = machineName };

            var processorStatusOrchestrator = new Mock<IProcessorStatusOrchestrator>();
            var memoryStatusOrchestrator = new Mock<IMemoryStatusOrchestrator>();
            var storageStatusOrchestrator = new Mock<IStorageStatusOrchestrator>();

            var systemStatusOrchestrator = new SystemStatusOrchestrator(
                processorStatusOrchestrator.Object, memoryStatusOrchestrator.Object, storageStatusOrchestrator.Object);

            // Act
            var result = systemStatusOrchestrator.GetSystemStatusViewModel(sytemInformation);

            // Assert
            Assert.AreEqual(machineName, result.MachineName);
        }