private void 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 IisExpressServerManager(Current); _serviceContainer = new ServiceContainer(); _serviceContainer.RemoveService(typeof(IConfigurationService)); _serviceContainer.RemoveService(typeof(IControlPanel)); var scope = ManagementScope.Site; _serviceContainer.AddService(typeof(IControlPanel), new ControlPanel()); _serviceContainer.AddService(typeof(IConfigurationService), new ConfigurationService(null, _server.Sites[0].GetWebConfiguration(), scope, null, _server.Sites[0], null, null, null, _server.Sites[0].Name)); _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 AuthenticationModule(); module.TestInitialize(_serviceContainer, null); _feature = new BasicAuthenticationFeature(module); _feature.Load(); }