feat: add fnOS packaging, storage workflows and release pipeline
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
using dy.net.model.dto;
|
||||
using dy.net.model.entity;
|
||||
using dy.net.repository;
|
||||
using dy.net.Tests.TestInfrastructure;
|
||||
using SqlSugar;
|
||||
|
||||
namespace dy.net.Tests;
|
||||
|
||||
public class VideoQueryTests
|
||||
{
|
||||
[Fact]
|
||||
public async Task AuthorIdFilter_DoesNotMixAuthorsWithTheSameDisplayName()
|
||||
{
|
||||
using var temporary = new TemporaryDirectory();
|
||||
using var db = new SqlSugarClient(new ConnectionConfig
|
||||
{
|
||||
ConnectionString = $"DataSource={Path.Combine(temporary.Path, "videos.sqlite")}",
|
||||
DbType = DbType.Sqlite,
|
||||
InitKeyType = InitKeyType.Attribute,
|
||||
IsAutoCloseConnection = true
|
||||
});
|
||||
db.CodeFirst.InitTables<DouyinVideo, DouyinCookie>();
|
||||
await db.Insertable(new[]
|
||||
{
|
||||
Video("one", "author-one"),
|
||||
Video("two", "author-two")
|
||||
}).ExecuteCommandAsync();
|
||||
|
||||
var (items, total) = await new DouyinVideoRepository(db).GetPagedAsync(new DouyinVideoPageRequestDto
|
||||
{
|
||||
PageIndex = 1,
|
||||
PageSize = 20,
|
||||
AuthorId = "author-two",
|
||||
ViedoType = "*"
|
||||
});
|
||||
|
||||
Assert.Equal(1, total);
|
||||
Assert.Equal("two", Assert.Single(items).Id);
|
||||
}
|
||||
|
||||
private static DouyinVideo Video(string id, string authorId) => new()
|
||||
{
|
||||
Id = id,
|
||||
AwemeId = id + "-aweme",
|
||||
Author = "同名博主",
|
||||
AuthorId = authorId,
|
||||
VideoTitle = id,
|
||||
VideoSavePath = $"/{id}.mp4",
|
||||
ViedoType = VideoTypeEnum.dy_follows,
|
||||
CreateTime = DateTime.Now,
|
||||
SyncTime = DateTime.Now
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user