Ejemplo n.º 1
0
 /// <summary>
 /// Write the specified stanza to the stream.
 /// </summary>
 /// <param name="elem"></param>
 public void Write(XmlElement elem)
 {
     if ((m_overrideFrom != null) && (elem.GetAttribute("from") == ""))
     {
         elem.SetAttribute("from", m_overrideFrom);
     }
     m_stream.Write(elem);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Write the specified stanza to the stream.
        /// </summary>
        /// <param name="elem"></param>
        public void Write(XmlElement elem)
        {
            if (this.OverrideFrom != null && elem.GetAttribute("from") == "")
            {
                elem.SetAttribute("from", this.OverrideFrom);
            }

            m_stream.Write(elem);
        }
        private void SendMessage(bool shouldJoinRoom)
        {
            using (mocks.Record())
            {
                CreateJoinExpected(CreateJoinResponsePacket);

                Expect.Call(stream.Document).Return(doc);
                stream.Write((XmlElement)null);
                LastCall.Callback((Func <XmlElement, bool>)
                                  delegate(XmlElement elem)
                {
                    string id       = elem.GetAttribute("id");
                    string original = elem.OuterXml;
                    return(original.Replace(" ", "") == GetRoomMessage(id).Replace(" ", ""));
                });
            }

            using (mocks.Playback())
            {
                Room testRoom = CreateRoomPlayback(shouldJoinRoom, delegate { return(null); });
                testRoom.PublicMessage(MESSAGE);
            }
        }