-
Notifications
You must be signed in to change notification settings - Fork 524
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
给GetLinks新增单元测试,这次更换下载站的时候,文件拷贝过去,最后修改时间改变了。
那个 System.Data.SQLite.zip 成为了最新的一个文件
- Loading branch information
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using NewLife; | ||
using NewLife.Web; | ||
using Xunit; | ||
|
||
namespace XUnitTest.Web; | ||
|
||
public class WebClientTests | ||
{ | ||
[Fact] | ||
public void GetLinks() | ||
{ | ||
var client = new WebClientX(); | ||
var links = client.GetLinks("http://x.newlifex.com"); | ||
Assert.NotEmpty(links); | ||
|
||
var names = "System.Data.SQLite.win-x64,System.Data.SQLite.win,System.Data.SQLite_net80,System.Data.SQLite_netstandard21,System.Data.SQLite_netstandard20,System.Data.SQLite".Split(",", ";"); | ||
|
||
links = links.Where(e => e.Name.EqualIgnoreCase(names) || e.FullName.EqualIgnoreCase(names)).ToArray(); | ||
var link = links.OrderByDescending(e => e.Version).ThenByDescending(e => e.Time).FirstOrDefault(); | ||
|
||
Assert.NotNull(link); | ||
Assert.Equal("System.Data.SQLite.win-x64", link.Name); | ||
Assert.True(link.Time >= "2024-05-14".ToDateTime()); | ||
Assert.Null(link.Version); | ||
} | ||
} |