Files
wx-win-agent/tests/node-agent/WxAgent.Core.Tests/RemoteAccountContextTests.cs
T
rogee e8abb15f68
Build web service image / build (push) Successful in 1m6s
fix: authorize verified offline data sync
2026-09-30 13:30:48 +08:00

44 lines
1.3 KiB
C#

using WxAgent.Core;
using Xunit;
namespace WxAgent.Core.Tests;
public sealed class RemoteAccountContextOfflineSyncTests
{
[Fact]
public void OfflineSessionNeverSelectsAnActiveUiAccount()
{
var identities = new[] { new RemoteAccountIdentity("root-a", true) };
Assert.Null(RemoteAccountContext.SelectActiveAccountId(
false, "root-a", identities, ["root-a"]));
}
[Fact]
public void ActiveSelectionRequiresLiveAndVerifiedBinding()
{
var identities = new[]
{
new RemoteAccountIdentity("offline", true),
new RemoteAccountIdentity("unverified", false),
new RemoteAccountIdentity("live", true)
};
Assert.Equal("live", RemoteAccountContext.SelectActiveAccountId(
true, "offline", identities, ["unverified", "live"]));
}
[Fact]
public void MultipleLiveBindingsRequireAnExplicitAccount()
{
var identities = new[]
{
new RemoteAccountIdentity("root-a", true),
new RemoteAccountIdentity("root-b", true)
};
Assert.Null(RemoteAccountContext.SelectActiveAccountId(true, null, identities, ["root-a", "root-b"]));
Assert.Equal("root-b", RemoteAccountContext.SelectActiveAccountId(true, "root-b", identities, ["root-a", "root-b"]));
}
}