Exemple #1
0
        public void DeserializeMinimalisticXml()
        {
            // an empty deserialized message and new message must be equal
            var mmm = MailMergeMessage.Deserialize("<MailMergeMessage></MailMergeMessage>");

            Assert.True(new MailMergeMessage().Equals(mmm));
        }
Exemple #2
0
        public void SerializationFromToString()
        {
            var mmm    = MessageFactory.GetMessageWithAllPropertiesSet();
            var result = mmm.Serialize();
            var back   = MailMergeMessage.Deserialize(result);

            Assert.True(mmm.Equals(back));
            Assert.AreEqual(mmm.Serialize(), back.Serialize());
        }
Exemple #3
0
        public void SerializationFromToFile()
        {
            var filename = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
            var mmm      = MessageFactory.GetMessageWithAllPropertiesSet();

            mmm.Serialize(filename, Encoding.Unicode);
            var back = MailMergeMessage.Deserialize(filename, Encoding.Unicode);

            Assert.True(mmm.Equals(back));
            Assert.AreEqual(mmm.Serialize(), back.Serialize());
        }
Exemple #4
0
        public void SerializationFromToStream()
        {
            var mmm   = MessageFactory.GetMessageWithAllPropertiesSet();
            var msOut = new MemoryStream();

            mmm.Serialize(msOut, Encoding.UTF8);
            msOut.Position = 0;

            var back = MailMergeMessage.Deserialize(msOut, Encoding.UTF8);

            msOut.Close();
            msOut.Dispose();

            Assert.True(mmm.Equals(back));
            Assert.AreEqual(mmm.Serialize(), back.Serialize());
        }