public void InvalidXmlRootName()
        {
            const string      xmlString  = "<lol><server>irc.somewhere.net</server><protocol>IRC</protocol></lol>";
            Mock <IIrcWriter> mockWriter = new Mock <IIrcWriter>(MockBehavior.Strict);

            Assert.Throws <ValidationException>(
                () => ConnectedEventArgsExtensions.FromXml(xmlString, mockWriter.Object)
                );
        }
        public void MissingProtocolDuringXmlParsing()
        {
            const string      xmlString  = "<chaskis_connect_event><server>irc.somewhere.net</server></chaskis_connect_event>";
            Mock <IIrcWriter> mockWriter = new Mock <IIrcWriter>(MockBehavior.Strict);

            Assert.Throws <ValidationException>(
                () => ConnectedEventArgsExtensions.FromXml(xmlString, mockWriter.Object)
                );
        }
        public void XmlRoundTripTest()
        {
            const string server = "irc.somewhere.net";
            const ChaskisEventProtocol protocol   = ChaskisEventProtocol.IRC;
            Mock <IIrcWriter>          mockWriter = new Mock <IIrcWriter>(MockBehavior.Strict);

            ConnectedEventArgs uut       = new ConnectedEventArgs(server, protocol, mockWriter.Object);
            string             xmlString = uut.ToXml();
            ConnectedEventArgs postXml   = ConnectedEventArgsExtensions.FromXml(xmlString, mockWriter.Object);

            Assert.AreEqual(uut.Server, postXml.Server);
            Assert.AreEqual(uut.Protocol, postXml.Protocol);
            Assert.AreSame(uut.Writer, postXml.Writer);
        }