44 lines
1.3 KiB
C#
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"]));
|
|
}
|
|
}
|