refactor: split node agent and Go control plane
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
using WxAgent.Core;
|
||||
using Xunit;
|
||||
|
||||
namespace WxAgent.Core.Tests;
|
||||
|
||||
public sealed class WechatNoteWindowTests
|
||||
{
|
||||
[Fact]
|
||||
public void OnlyAFreshVisibleNoteInTheExpectedProcessIsSelected()
|
||||
{
|
||||
WechatNoteWindowCandidate[] windows = [
|
||||
new(1, 10, "笔记", true, false), // Existing note must not be exported instead of the selected message.
|
||||
new(2, 10, "笔记交流群", true, true),
|
||||
new(3, 20, "笔记", true, false),
|
||||
new(4, 10, "笔记", false, false),
|
||||
new(5, 10, "微信", true, false),
|
||||
new(6, 10, "笔记", true, false)];
|
||||
Assert.Equal(6, WechatNoteWindow.FindOpened(windows, 10, new HashSet<long> { 1 }));
|
||||
Assert.Null(WechatNoteWindow.FindOpened(windows[..5], 10, new HashSet<long> { 1 }));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AmbiguousNewNotesAreRejected()
|
||||
{
|
||||
var error = Assert.Throws<WxAgentException>(() => WechatNoteWindow.FindOpened([
|
||||
new(1, 10, "笔记", true, false), new(2, 10, "笔记", true, false)], 10, new HashSet<long>()));
|
||||
Assert.Equal(WxAgentErrorCode.UiStructureChanged, error.Code);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RepeatedNoteParagraphsMustRemainRepeated()
|
||||
{
|
||||
var content = new WechatNoteContent([
|
||||
new("text", "重复段落"), new("text", "重复段落")]);
|
||||
Assert.Equal("重复段落\n\n重复段落", content.ToMarkdown().ReplaceLineEndings("\n"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user