private void PerformSystemChecks(IList <ISystemValidation> validations, IProgressReporter progressReporter, ICmdlet cmdlet, TextSummaryOutputWriter summaryWriter, PsObjectsOutputWriter psObjectsWriter)
        {
            PowerShellCommandRunner commandRunner = null;

            try
            {
                commandRunner = new PowerShellCommandRunner(this.ComputerNameValue.Value, this.Credential);
            }
            catch
            {
                this.WriteWarning(
                    $"Establishing management service connection with host '{this.ComputerNameValue.Value}' as {this.UserName} didn't work." + Environment.NewLine +
                    $"Ensure {this.UserName} has administrative rights and that the process is running with administrative permissions." + Environment.NewLine +
                    $"You can also use -SkipSystemChecks switch to skip system requirements checks.");
                throw;
            }

            var outputWriters = new List <IOutputWriter>
            {
                summaryWriter,
                psObjectsWriter
            };

            SystemValidationsProcessor systemChecksProcessor = new SystemValidationsProcessor(commandRunner, validations, outputWriters, progressReporter);

            systemChecksProcessor.Run();
        }
        public void AllOutputWritersReceiveTheValidationResults()
        {
            // Prepare
            var powershellCommandRunnerMockFactory     = new Moq.Mock <IPowershellCommandRunner>();
            var systemValidationMockFactory            = new Moq.Mock <ISystemValidation>();
            List <ISystemValidation> systemValidations = new List <ISystemValidation>
            {
                systemValidationMockFactory.Object
            };
            var outputWriterMockFactory1 = new Moq.Mock <IOutputWriter>();

            outputWriterMockFactory1.Setup(outputWriter => outputWriter.Write(It.IsAny <IValidationResult>())).Verifiable();
            var outputWriterMockFactory2 = new Moq.Mock <IOutputWriter>();

            outputWriterMockFactory2.Setup(outputWriter => outputWriter.Write(It.IsAny <IValidationResult>())).Verifiable();
            List <IOutputWriter> outputWriters = new List <IOutputWriter>
            {
                outputWriterMockFactory1.Object,
                outputWriterMockFactory2.Object
            };
            var progressReporterFactory = new Mock <IProgressReporter>();

            // Exercise
            SystemValidationsProcessor systemValidationsProcessor = new SystemValidationsProcessor(powershellCommandRunnerMockFactory.Object, systemValidations, outputWriters, progressReporterFactory.Object);

            systemValidationsProcessor.Run();

            // Verify
            outputWriterMockFactory1.Verify(outputWriter => outputWriter.Write(It.IsAny <IValidationResult>()), Times.AtMostOnce());
            // Only available in updated Moq library
            //outputWriterMockFactory1.VerifyNoOtherCalls();
            outputWriterMockFactory2.Verify(outputWriter => outputWriter.Write(It.IsAny <IValidationResult>()), Times.AtMostOnce());
            // Only available in updated Moq library
            //outputWriterMockFactory2.VerifyNoOtherCalls();
        }