/// <summary> /// Initializes a new instance of the <see cref="CrmRoleProviderTest"/> class. /// </summary> public CrmRoleProviderTest() { var cacheService = Substitute.For <ICacheService>(); var userRepository = Substitute.For <UserRepositoryBase>(cacheService); this.roleRepository = Substitute.For <RoleRepositoryBase>(userRepository, cacheService); this.roleRepositoryFactory = Substitute.For <IRoleRepositoryFactory>(); this.roleRepositoryFactory.GetRepository(Arg.Any <ConfigurationSettings>()).Returns(this.roleRepository); var config = new NameValueCollection(); config.Add("name", "crm"); config.Add("applicationName", "CRM security provider"); config.Add("readOnly", "false"); config.Add("connectionStringName", "CRMConnString"); this.crmRoleProvider = new CRMRoleProvider(this.roleRepositoryFactory); this.crmRoleProvider.Initialize(config["name"], config); this.role = new CRMRole("test", Guid.NewGuid()); }
/// <summary> /// Initializes a new instance of the <see cref="CRMRoleProvider"/> class. /// </summary> /// <param name="roleRepositoryFactory">The role repository factory.</param> public CRMRoleProvider(IRoleRepositoryFactory roleRepositoryFactory) { Assert.ArgumentNotNull(roleRepositoryFactory, "roleRepositoryFactory"); this.roleRepositoryFactory = roleRepositoryFactory; }