コード例 #1
0
        private static Signup_Result UserTags_Validation(TMConfig config, UserTag tag)
        {
            var signupResponse = new Signup_Result();
            var validationList = tag.validate();

            signupResponse.Signup_Status = Signup_Result.SignupStatus.Validation_Failed;
            signupResponse.UserCreated   = 0;
            if (!config.showDetailedErrorMessages())
            {
                signupResponse.Simple_Error_Message = config.TMErrorMessages.General_SignUp_Error_Message;
            }
            else
            {
                foreach (var validation in validationList)
                {
                    signupResponse.Validation_Results.Add(new Validation_Results {
                        Field = validation.ToString(), Message = validation.ErrorMessage
                    });
                }
            }
            return(signupResponse);
        }
コード例 #2
0
        public void Issue_826__No_lenght_constraint_on_User_Tags_SigupResponse()
        {
            var userData = new TM_UserData();
            var newUser  = new NewUser().with_Random_Data();

            newUser.validate().asStringList().assert_Is_Empty();

            var userTag_Ok = new UserTag {
                Key = 254.randomLetters(), Value = 254.randomLetters()
            };
            var userTag_Fail = new UserTag {
                Key = 256.randomLetters(), Value = 256.randomLetters()
            };

            userTag_Ok.validate().assert_Empty();
            userTag_Fail.validate().assert_Not_Empty();

            newUser.UserTags.add(userTag_Ok);
            userData.createTmUserResponse(newUser).UserCreated.assert_Is_Not(0);

            newUser.UserTags.add(userTag_Fail);
            userData.createTmUser(newUser).assert_Is(0);
        }