示例#1
0
        public void GetMessagesToPlayerTest()
        {
            MessageDAO target = new MessageDAO();
            PlayerDAO  player = new PlayerDAO();

            Message message = CreateMessage();

            target.InsertMessage(message);
            List <Message> inserted = target.GetMessagesToPlayer(playerTo.PlayerId);

            Assert.IsTrue(inserted.Count == 1);
            target.RemoveMessage(inserted[0].MessageId);
        }
示例#2
0
        public void RemoveMessageTest()
        {
            MessageDAO target = new MessageDAO();
            PlayerDAO  player = new PlayerDAO();

            Message message = CreateMessage();

            target.InsertMessage(message);
            List <Message> inserted = target.GetMessagesFrom(playerFrom.PlayerName);

            target.RemoveMessage(inserted[0].MessageId);
            Assert.IsNull(target.GetMessage(inserted[0].MessageId));
        }
        public override void Run()
        {
            List <ReferenceData.Entity.Message> mList = (List <ReferenceData.Entity.Message>)data.Data;

            foreach (var message in mList)
            {
                messageDAO.InsertMessage(message);
                foreach (var onl in worker.Server.OnlineList)
                {
                    foreach (var u in message.Conversation.memberList)
                    {
                        if (u.id == onl.Acc.id && u.id != message.senderId)
                        {
                            onl.Worker.send(new SocketData("MESSAGE", message));
                        }
                    }
                }
            }
        }