예제 #1
0
        public async void PasswordSalt_Update_null()
        {
            Mock <IPasswordRepository> passwordRepository = new Mock <IPasswordRepository>();

            passwordRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Password()));

            var validator = new ApiPasswordRequestModelValidator(passwordRepository.Object);
            await validator.ValidateUpdateAsync(default(int), new ApiPasswordRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.PasswordSalt, null as string);
        }
예제 #2
0
        public async void PasswordHash_Create_length()
        {
            Mock <IPasswordRepository> passwordRepository = new Mock <IPasswordRepository>();

            passwordRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Password()));

            var validator = new ApiPasswordRequestModelValidator(passwordRepository.Object);
            await validator.ValidateCreateAsync(new ApiPasswordRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.PasswordHash, new string('A', 129));
        }