public async Task SetUp() { const string Original = @"original.config"; const string OriginalMono = @"original.mono.config"; if (Helper.IsRunningOnMono()) { File.Copy("Website1/original.config", "Website1/web.config", true); File.Copy(OriginalMono, Current, true); } else { File.Copy("Website1\\original.config", "Website1\\web.config", true); File.Copy(Original, Current, true); } Environment.SetEnvironmentVariable( "JEXUS_TEST_HOME", Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); _server = new ServerManager(Current) { Mode = WorkingMode.IisExpress }; _serviceContainer = new ServiceContainer(); _serviceContainer.RemoveService(typeof(IConfigurationService)); _serviceContainer.RemoveService(typeof(IControlPanel)); var scope = ManagementScope.Server; _serviceContainer.AddService(typeof(IControlPanel), new ControlPanel()); _serviceContainer.AddService(typeof(IConfigurationService), new ConfigurationService(null, _server.GetApplicationHostConfiguration(), scope, _server, null, null, null, null, null)); _serviceContainer.RemoveService(typeof(IManagementUIService)); var mock = new Mock <IManagementUIService>(); mock.Setup( action => action.ShowMessage( It.IsAny <string>(), It.IsAny <string>(), It.IsAny <MessageBoxButtons>(), It.IsAny <MessageBoxIcon>(), It.IsAny <MessageBoxDefaultButton>())).Returns(DialogResult.Yes); _serviceContainer.AddService(typeof(IManagementUIService), mock.Object); var module = new HttpErrorsModule(); module.TestInitialize(_serviceContainer, null); _feature = new HttpErrorsFeature(module); _feature.Load(); }