Xnl序列化空字符串测试
This commit is contained in:
parent
205df40786
commit
ef717dfca5
38
Falcon.SugarApi.Test/XmlSerializeTest.cs
Normal file
38
Falcon.SugarApi.Test/XmlSerializeTest.cs
Normal file
|
@ -0,0 +1,38 @@
|
|||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Falcon.SugarApi.XmlSerialize;
|
||||
using System;
|
||||
|
||||
namespace Falcon.SugarApi.Test
|
||||
{
|
||||
/// <summary>
|
||||
/// xml序列化测试
|
||||
/// </summary>
|
||||
[TestClass]
|
||||
public class XmlSerializeTest
|
||||
{
|
||||
/// <summary>
|
||||
/// 一般xml序列化测试
|
||||
/// </summary>
|
||||
[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; } = "";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user