/// <summary>
        /// Initializes a new instance of the <see cref="IISConfigurationService"/> class
        /// </summary>
        /// <param name="configManager"> Details of the IIS Executable and config </param>
        /// <param name="configValidationService"> An IISExpressConfigValidationService implementation to validate the config values </param>
        public IISConfigurationService(IConfigurationManager<IISConfig> configManager, IConfigValidationService configValidationService)
        {
            if (configManager == null)
            {
                throw new ArgumentNullException("configManager");
            }

            if (configValidationService == null)
            {
                throw new ArgumentNullException("configValidationService");
            }

            this._configManager = configManager;
            this._iisConfig = this._configManager.GetSection("IISExpress");

            if (!IsConfigurationValid(this._iisConfig, configValidationService))
            {
                throw new Exception<IISConfigExceptionArgs>(new IISConfigExceptionArgs(this._iisConfig.IIsExecutablePath, this._iisConfig.IISConfigFilePath));
            }
        }
        public void WhenTheIISConfigHasAnInvalidIIsExecutablePathPropertyAnExceptionIsThrown()
        {
            var localConfig = new IISConfig
                { IIsExecutablePath = "zz:/RubishPath", IISConfigFilePath = "yy:/MoreRubbish" };
            this.mockConfigManager.Setup(c => c.GetSection(It.IsAny<string>())).Returns(localConfig);

            Assert.Throws(
                Is.TypeOf<Exception<IISConfigExceptionArgs>>().And.Message.Contains("zz:/RubishPath"),
                () =>
                    {
                        this.configService = new IISConfigurationService(
                            this.mockConfigManager.Object, this.mockValidation.Object);
                    });
        }
 /// <summary>
 /// Private method to determin whether the IISConfig values are valid paths
 /// </summary>
 /// <param name="config"> IISConfig </param>
 /// <param name="configValidationService"> IConfigValidationService </param>
 /// <returns> True if IISConfig is valid, else false</returns>
 private static bool IsConfigurationValid(IISConfig config, IConfigValidationService configValidationService)
 {
     return configValidationService.IsSatisfiedBy(config);
 }
 /// <summary>
 /// Method to ensure the IExecutableDetails objects properties hold valid paths
 /// </summary>
 /// <param name="details"> the IExecutableDetails containing the path data </param>
 /// <returns> True if the exe and config paths are valid </returns>
 public bool IsSatisfiedBy(IISConfig details)
 {
     return File.Exists(details.IIsExecutablePath) && File.Exists(details.IISConfigFilePath);
 }