public void TestLoadFromXml() { var xml = @"<Root> <Envelop> <Message>Hello world</Message> </Envelop> </Root>"; Envelop envelop = XmlSerialization.LoadFromXml <Envelop>(xml); Assert.AreEqual("<Message>Hello world</Message>", envelop.Message); }
public void TestToXml() { Envelop envelop = new Envelop() { Message = "<Message>Hello world</Message>" }; string xml = envelop.ToXml(); XDocument doc = XDocument.Parse(xml); XElement elementInner = doc.XPathSelectElement("/Root/Envelop/Message"); Assert.AreEqual("Hello world", elementInner.Value); }