Skip to content

Commit dd278cd

Browse files
committed
test: 更新单元测试
1 parent 2dda68d commit dd278cd

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/UnitTest/Utils/UtilityTest.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using System.ComponentModel.DataAnnotations;
1111
using System.Data;
1212
using System.Globalization;
13+
using System.Net;
1314
using System.Reflection;
1415
using UnitTest.Components;
1516

@@ -742,6 +743,23 @@ public void FormatIp_Test()
742743
Assert.Equal("192.168.1.###", result);
743744
}
744745

746+
[Fact]
747+
public void ConvertToIPAddress_Ok()
748+
{
749+
var ex = Assert.Throws<ArgumentNullException>(() => Utility.ConvertToIPAddress(""));
750+
Assert.NotNull(ex);
751+
752+
var address = Utility.ConvertToIPAddress("any");
753+
Assert.Equal(IPAddress.Any, address);
754+
}
755+
756+
[Fact]
757+
public void ConvertToIpEndPoint_Ok()
758+
{
759+
var ex = Assert.Throws<ArgumentOutOfRangeException>(() => Utility.ConvertToIpEndPoint("localhost", 88990));
760+
Assert.NotNull(ex);
761+
}
762+
745763
[AutoGenerateClass(Align = Alignment.Center)]
746764
private class Dog
747765
{

0 commit comments

Comments
 (0)