diff --git a/Falcon.SugarApi.Test/XmlSerializeTest.cs b/Falcon.SugarApi.Test/XmlSerializeTest.cs new file mode 100644 index 0000000..bca4454 --- /dev/null +++ b/Falcon.SugarApi.Test/XmlSerializeTest.cs @@ -0,0 +1,38 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Falcon.SugarApi.XmlSerialize; +using System; + +namespace Falcon.SugarApi.Test +{ + /// + /// xml序列化测试 + /// + [TestClass] + public class XmlSerializeTest + { + /// + /// 一般xml序列化测试 + /// + [TestMethod] + public void JsonSerializeDITest() { + IXmlSerialize ser = new XmlSerializeFactory().CreateXmlSerialize(s => { + + }); + Assert.IsNotNull(ser); + + var obj = new XmlObject(); + var str = ser.Serialize(obj); + Assert.IsNotNull(str); + Console.WriteLine(str); + Assert.IsTrue(str.IndexOf("NullStr") >= 0); + } + + public class XmlObject + { + public string? NullStr { get; set; } = null; + public string? EmptyStr { get; set; } = string.Empty; + public string? EmptyStr2 { get; set; } = ""; + } + } + +}