Skip to content

Commit

Permalink
给GetLinks新增单元测试,这次更换下载站的时候,文件拷贝过去,最后修改时间改变了。
Browse files Browse the repository at this point in the history
那个 System.Data.SQLite.zip 成为了最新的一个文件
  • Loading branch information
nnhy committed Oct 17, 2024
1 parent c3c39c9 commit 685f9c4
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions XUnitTest.Core/Web/WebClientTests.cs
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);
}
}

0 comments on commit 685f9c4

Please sign in to comment.