From ef717dfca56a666e378faf24ed491020e1c22d94 Mon Sep 17 00:00:00 2001 From: FalconFly <12919280+falconfly@user.noreply.gitee.com> Date: Wed, 21 Jun 2023 08:49:19 +0800 Subject: [PATCH] =?UTF-8?q?Xnl=E5=BA=8F=E5=88=97=E5=8C=96=E7=A9=BA?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E4=B8=B2=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Falcon.SugarApi.Test/XmlSerializeTest.cs | 38 ++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Falcon.SugarApi.Test/XmlSerializeTest.cs 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; } = ""; + } + } + +}