Example #1
0
		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);
		}
Example #2
0
		public void Configure_ConfigChanged_NewContainerCreated() {
			var originalConfig = CreateConfig("<ldapServer default='true' value='ldapServer' />");
			var newConfig = CreateConfig("<ldapServer default='true' value='ldapServer' />");
			A.CallTo(() => configRepository.GetConfig()).Returns(originalConfig);

			var serverConfig = A.Fake<IServerConfig>();
			A.CallTo(() => serverConfigFactory.Create(A<IConfig>.Ignored)).Returns(serverConfig);

			var ldapConfig = new LdapConfig("ldapServer",
			                                configRepository,
			                                serverConfigFactory,
			                                usersConfigFactory,
			                                groupsConfigFactory);

			var origianlContainer = ldapConfig.Container;
			originalConfig.Discard();

			Assert.AreNotSame(origianlContainer, ldapConfig.Container);
		}