示例#1
0
        protected UserInfo CreateUserWithVerifiedEmailAddress(string email, string password)
        {
            SnCore.WebServices.WebAccountService.WebAccountService endpoint = new SnCore.WebServices.WebAccountService.WebAccountService();

            UserInfo result = new UserInfo();
            result.email = email;
            result.password = password;

            result.id = CreateUser(email, password);
            Assert.IsTrue(result.id > 0);

            result.ticket = Login(email, password);
            Assert.IsNotEmpty(result.ticket);

            Assert.IsFalse(endpoint.HasVerifiedEmail(result.ticket, result.id));
            SnCore.WebServices.WebAccountService.TransitAccountEmailConfirmation[] confirmations = endpoint.GetAccountEmailConfirmations(
                GetAdminTicket(), result.id, null);

            string verifiedemail = endpoint.VerifyAccountEmail(
                confirmations[0].Id, confirmations[0].Code);

            Console.WriteLine("Verified: {0}", verifiedemail);
            Assert.AreEqual(verifiedemail, result.email);
            Assert.IsTrue(endpoint.HasVerifiedEmail(result.ticket, result.id));

            return result;
        }