public async Task SuccessIfNullUser()
        {
            // Setup
            var validator = new PreventPasswordChangeValidator <IdentityUser>();
            var manager   = MockHelpers.TestUserManager <IdentityUser>();
            var password  = "******";

            // Act
            // Assert
            IdentityResultAssert.IsSuccess(await validator.ValidateAsync(manager, null, password));
        }
        public async Task SuccessIfUserWithDefaultId()
        {
            var manager   = MockHelpers.TestUserManager <IdentityUser>();
            var validator = new PreventPasswordChangeValidator <IdentityUser>();
            var user      = new IdentityUser {
                UserName = "******", Id = default(string)
            };
            var password = "******";

            IdentityResultAssert.IsSuccess(await validator.ValidateAsync(manager, user, password));
        }
        public async Task ValidateThrowsWithNullTest()
        {
            // Setup
            var validator = new PreventPasswordChangeValidator <IdentityUser>();

            // Act
            // Assert
            await Assert.ThrowsAsync <ArgumentNullException>("password", () => validator.ValidateAsync(null, null, null));

            await Assert.ThrowsAsync <ArgumentNullException>("manager", () => validator.ValidateAsync(null, null, "foo"));
        }
        public async Task FailsIfUserWithIdAndPasswordHash()
        {
            var manager   = MockHelpers.TestUserManager <IdentityUser>();
            var validator = new PreventPasswordChangeValidator <IdentityUser>();
            var user      = new IdentityUser
            {
                UserName     = "******",
                Id           = Guid.NewGuid().ToString(),
                PasswordHash = "not null",
            };
            var password = "******";

            IdentityResultAssert.IsFailure(await validator.ValidateAsync(manager, user, password), _error);
        }