Ejemplo n.º 1
0
        /// <summary>
        /// Creates and returns a new token member,
        /// subscribed to notifications via a fake bank.
        /// </summary>
        /// <param name="tokenClient">SDK client</param>
        /// <returns>a new Member instance</returns>
        public static UserMember CreateMember(Tokenio.User.TokenClient tokenClient)
        {
            // Token members "in the real world" are set up to receive notifications:
            // The Token mobile app, having created a new member, subscribes to
            // notifications so they're delivered to the mobile device.
            //
            // When we create a member via createMember for testing, it's not
            // set up to receive notifications. If we try to send a notification
            // to this member, we would get a NO_SUBSCRIBERS error.
            // We set up a fake bank subscription for testing
            // (but we wouldn't do this in production for "real-world" members).
            Alias alias = new Alias
            {
                Type  = Alias.Types.Type.Email,
                Value = "test-" + Util.Nonce() + "*****@*****.**"
            };

            UserMember member = tokenClient.CreateMemberBlocking(alias);

            member.SubscribeToNotificationsBlocking("iron");
            return(member);
        }