Skip to content

Commit a0810c3

Browse files
committed
test: 增加单元测试
1 parent 3125599 commit a0810c3

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

test/UnitTest/Converters/JsonDescriptionEnumConverterTest.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,19 @@ public void JsonEnumConverter_Ok()
5252
Assert.Equal("\"\"", json);
5353
}
5454

55+
[Fact]
56+
public void ColumnVisibleItemConverter_Ok()
57+
{
58+
var item = new ColumnVisibleItem("name", true) { DisplayName = "display" };
59+
var json = JsonSerializer.Serialize(item);
60+
61+
Assert.Equal("{\"name\":\"name\",\"visible\":true}", json);
62+
63+
var item1 = JsonSerializer.Deserialize<ColumnVisibleItem>(json);
64+
Assert.Equal("name", item1.Name);
65+
Assert.True(item1.Visible);
66+
}
67+
5568
[JsonConverter(typeof(JsonDescriptionEnumConverter<TestEnum>))]
5669
public enum TestEnum
5770
{
@@ -100,5 +113,4 @@ public enum EnumBarcodeTextFontOption
100113
[Description("bold italic")]
101114
Bold_Italic,
102115
}
103-
104116
}

0 commit comments

Comments
 (0)