Skip to content

Commit 2ac280f

Browse files
committed
🔧 Fix(Test): Some functions not supported on some platforms.
1 parent d23bc10 commit 2ac280f

1 file changed

Lines changed: 17 additions & 8 deletions

File tree

‎Common.BasicHelper.Test/Network/NetUtils_Tests.cs‎

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,36 @@ public class NetUtils_Tests
88
[TestMethod]
99
public void Test_IsWebConected()
1010
{
11-
Assert.IsTrue(NetUtils.IsWebConected("localhost", 3));
12-
Assert.IsFalse(NetUtils.IsWebConected("192.168.255.255", 3));
11+
if (OperatingSystem.IsWindows())
12+
{
13+
Assert.IsTrue(NetUtils.IsWebConected("localhost", 3));
14+
Assert.IsFalse(NetUtils.IsWebConected("192.168.255.255", 3));
15+
}
1316
}
1417

1518
[TestMethod]
1619
public void Test_DownloadFile()
1720
{
18-
var path = Path.GetFullPath($"{Path.GetTempPath()}/test_downloadFile.txt");
21+
if (OperatingSystem.IsWindows())
22+
{
23+
var path = Path.GetFullPath($"{Path.GetTempPath()}/test_downloadFile.txt");
1924

20-
NetUtils.DownloadFile(testDownloadFilePath, path);
25+
NetUtils.DownloadFile(testDownloadFilePath, path);
2126

22-
File.Delete(path);
27+
File.Delete(path);
28+
}
2329
}
2430

2531
[TestMethod]
2632
public void Test_WebDownloadFile()
2733
{
28-
var path = Path.GetFullPath($"{Path.GetTempPath()}/test_webDownloadFile.txt");
34+
if (OperatingSystem.IsWindows())
35+
{
36+
var path = Path.GetFullPath($"{Path.GetTempPath()}/test_webDownloadFile.txt");
2937

30-
NetUtils.WebDownloadFile(testDownloadFilePath, path);
38+
NetUtils.WebDownloadFile(testDownloadFilePath, path);
3139

32-
File.Delete(path);
40+
File.Delete(path);
41+
}
3342
}
3443
}

0 commit comments

Comments
 (0)