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)); }
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()); }
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()); }
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()); }