Ejemplo n.º 1
0
        /// <summary>
        /// Adds, removes, and resolves aliases.
        /// </summary>
        /// <param name="tokenClient">token client</param>
        /// <param name="member">member</param>
        /// <returns>resolved member ID and alias</returns>
        public static TokenMember Aliases(Tokenio.User.TokenClient tokenClient, UserMember member)
        {
            Alias alias1 = member.GetFirstAliasBlocking();

            Alias alias2 = new Alias
            {
                Type  = Alias.Types.Type.Email,
                Value = "alias2-" + Util.Nonce() + "*****@*****.**"
            };

            // add the alias
            member.AddAliasBlocking(alias2);

            Alias alias3 = new Alias
            {
                Type  = Alias.Types.Type.Email,
                Value = "alias3-" + Util.Nonce() + "*****@*****.**"
            };

            Alias alias4 = new Alias
            {
                Type  = Alias.Types.Type.Email,
                Value = "alias4-" + Util.Nonce() + "*****@*****.**"
            };

            member.AddAliasesBlocking((new[] { alias3, alias4 }).ToList());
            // remove the alias
            member.RemoveAliasBlocking(alias1);

            member.RemoveAliasesBlocking((new[] { alias2, alias3 }).ToList());

            TokenMember resolved = tokenClient.ResolveAliasBlocking(alias4);

            return(resolved);
        }