public UserStoreTests(string collectionPrefix)
		{
			collectionPrefix = $"{typeof(UserStoreTests).Name}_{collectionPrefix}";

			_databaseFixture = new DatabaseFixture(collectionPrefix);
			_userCollection = _databaseFixture.GetCollection<IdentityUser>();
			_roleCollection = _databaseFixture.GetCollection<IdentityRole>();
			_databaseContext = new IdentityDatabaseContext { UserCollection = _userCollection, RoleCollection = _roleCollection };

			_errorDescriber = new IdentityErrorDescriber();
			_userStore = new UserStore<IdentityUser, IdentityRole>(_databaseContext, null, _errorDescriber);


			_claim1 = new Claim("ClaimType1", "some value");
			_claim2 = new Claim("ClaimType2", "some other value");
			_claim3 = new Claim("other type", "some other value");

			_claim1SameType = new Claim(_claim1.Type, _claim1.Value + " different");

			_identityClaim1 = new IdentityClaim(_claim1);
			_identityClaim2 = new IdentityClaim(_claim2);
			_identityClaim3 = new IdentityClaim(_claim3);

			_identityClaim1SameType = new IdentityClaim(_claim1SameType);
		}
		public RoleStoreTests(string collectionPrefix)
		{
			collectionPrefix = $"{typeof(RoleStoreTests).Name}_{collectionPrefix}";

			_databaseFixture = new DatabaseFixture(collectionPrefix);
			_userCollection = _databaseFixture.GetCollection<IdentityUser>();
			_roleCollection = _databaseFixture.GetCollection<IdentityRole>();
			_databaseContext = new IdentityDatabaseContext { UserCollection = _userCollection, RoleCollection = _roleCollection };

			_userStore = new UserStore<IdentityUser, IdentityRole>(_databaseContext);
			_roleStore = new RoleStore<IdentityUser, IdentityRole>(_databaseContext);
			_errorDescriber = new IdentityErrorDescriber();
		}
Ejemplo n.º 3
0
 /// <summary>
 /// Creates a new instance of <see cref="UserValidator{TUser}"/>/
 /// </summary>
 /// <param name="errors">The <see cref="IdentityErrorDescriber"/> used to provider error messages.</param>
 public UserValidator(IdentityErrorDescriber errors = null)
 {
     Describer = errors ?? new IdentityErrorDescriber();
 }