예제 #1
0
        /// <summary>
        /// 发送无限大群消息测试
        /// </summary>
        void SendUnlimitedGroupMessage()
        {
            if (!user5566.IsOnline())
            {
                logger.DebugFormat("{0} offline, quit!", user5566.AppAccount);
                return;
            }
            long topicId = long.Parse(user5566.CreateUnlimitedGroup("testUC"));

            Thread.Sleep(100);

            if (topicId == 0)
            {
                logger.ErrorFormat("SendUnlimitedGroupMessage CreateUnlimitedGroup error , {0}-->{1},uuid:{2}", user5566.AppAccount, topicId, user5566.Uuid);
                return;
            }
            if (!user9527.IsOnline())
            {
                logger.DebugFormat("{0} offline, quit!", user9527.AppAccount);
                return;
            }
            user9527.JoinUnlimitedGroup(topicId);
            Thread.Sleep(2000);
            String result = user5566.GetUnlimitedGroupUsersNum(topicId);

            logger.InfoFormat("SendUnlimitedGroupMessage  result:{0}", result);
            String userListResult = user5566.GetUnlimitedGroupUsers(topicId);

            logger.InfoFormat("SendUnlimitedGroupMessage userListResult:{0}", userListResult);
            String packetId = null;

            for (int i = 0; i < 1; i++)
            {
                packetId = user5566.SendUnlimitedGroupMessage(topicId, UTF8Encoding.Default.GetBytes("Hi,everybody! I am 5566 " + DateTime.Now.ToString("u")), "UC", false);
                logger.DebugFormat("SendUnlimitedGroupMessage, {0}-->{1}, PacketId:{2},uuid:{3}, uuid2:{4}", user5566.AppAccount, topicId, packetId, user5566.Uuid, user9527.Uuid);
                //packetId = user9527.SendUnlimitedGroupMessage(topicId, UTF8Encoding.Default.GetBytes("Hi,everybody! I am 9527 " + DateTime.Now.ToString("u")), "UC", false);
                //logger.DebugFormat("SendUnlimitedGroupMessage, {0}-->{1}, PacketId:{2},uuid:{3}, uuid2:{4}", user9527.AppAccount, topicId, packetId, user9527.Uuid, user5566.Uuid);
                Thread.Sleep(5 * 1000);
            }
            Thread.Sleep(1000);
            user9527.QuitUnlimitedGroup(topicId);
            Thread.Sleep(1000);

            bool dismissFlag = user5566.DismissUnlimitedGroup(topicId);

            logger.InfoFormat("SendUnlimitedGroupMessage, DismissUnlimitedGroup AppAccount:{0}-->topicId:{1}, PacketId:{2},uuid:{3},uuid2:{4}", user5566.AppAccount, topicId, packetId, user5566.Uuid, user9527.Uuid);

            Thread.Sleep(1000);

            //if (dismissFlag)
            //{
            //    logger.InfoFormat("DismissUnlimitedGroup sucesss, {0} topicId:{1},uuid:{2}", leijun.AppAccount, topicId, leijun.Uuid);
            //    //测试不存在的情况
            //    packetId = leijun.SendUnlimitedGroupMessage(topicId, UTF8Encoding.Default.GetBytes("Hi,everybody!" + DateTime.Now.ToString("u")));
            //}
            //else
            //{
            //    logger.InfoFormat("DismissUnlimitedGroup fail, {0} topicId:{1},uuid:{2}", leijun.AppAccount, topicId, leijun.Uuid);
            //}
        }