public void Constructor_LdapNameDefinedInConfig_ReturnsLdapConfigWithUsersConfigSetFromFactory() { var config = CreateConfig("<ldapServer default='true' value='ldapServer' />"); A.CallTo(() => configRepository.GetConfig()).Returns(config); var usersConfig = A.Fake <IUsersConfig>(); A.CallTo(() => usersConfigFactory.Create(A <IConfig> .Ignored)).Returns(usersConfig); var ldapConfig = new LdapConfig("ldapServer", configRepository, serverConfigFactory, usersConfigFactory, groupsConfigFactory); Assert.AreSame(usersConfig, ldapConfig.Users); }
private void Configure(object sender, EventArgs e) { var config = sender as IConfig; if (config != null) { config.Discarded -= Configure; } config = configRepository.GetConfig(); var configSection = GetConfigSection(config); serverConfig = serverConfigFactory.Create(configSection); usersConfig = usersConfigFactory.Create(configSection); groupsConfig = groupsConfigFactory.Create(configSection); container = new Container(this); // Auto reconfigure all values when this config object is disposed (droped from the cache) config.Discarded += Configure; }