test(batch19): port accounts core mapped tests

This commit is contained in:
Joseph Doherty
2026-02-28 20:28:13 -05:00
parent e53b4aa17a
commit 8d00012ba8
5 changed files with 190 additions and 0 deletions

View File

@@ -246,6 +246,62 @@ public sealed class AccountTests
system.CheckServiceExportApproved(global, "$SYS.REQ.INFO", null).ShouldBeTrue();
}
[Fact] // T:81
public void MultipleStreamImportsWithSameSubjectDifferentPrefix_ShouldSucceed()
{
var fooAccount = Account.NewAccount("foo");
var barAccount = Account.NewAccount("bar");
var importAccount = Account.NewAccount("import");
fooAccount.AddStreamExport("test", null).ShouldBeNull();
barAccount.AddStreamExport("test", null).ShouldBeNull();
importAccount.AddStreamImport(fooAccount, "test", "foo").ShouldBeNull();
importAccount.AddStreamImport(barAccount, "test", "bar").ShouldBeNull();
importAccount.Imports.Streams.ShouldNotBeNull();
importAccount.Imports.Streams!.Count.ShouldBe(2);
importAccount.Imports.Streams.Select(si => si.To).OrderBy(static t => t).ToArray()
.ShouldBe(["bar.test", "foo.test"]);
}
[Fact] // T:82
public void MultipleStreamImportsWithSameSubject_ShouldSucceed()
{
var fooAccount = Account.NewAccount("foo");
var barAccount = Account.NewAccount("bar");
var importAccount = Account.NewAccount("import");
fooAccount.AddStreamExport("test", null).ShouldBeNull();
barAccount.AddStreamExport("test", null).ShouldBeNull();
importAccount.AddStreamImport(fooAccount, "test", string.Empty).ShouldBeNull();
importAccount.AddStreamImport(fooAccount, "test", string.Empty).ShouldBe(ServerErrors.ErrStreamImportDuplicate);
importAccount.AddStreamImport(barAccount, "test", string.Empty).ShouldBeNull();
importAccount.Imports.Streams.ShouldNotBeNull();
importAccount.Imports.Streams!.Count.ShouldBe(2);
importAccount.Imports.Streams.Select(si => si.Account?.Name).OrderBy(static n => n).ToArray()
.ShouldBe(["bar", "foo"]);
}
[Fact] // T:95
public void BenchmarkNewRouteReply()
{
var globalAccount = Account.NewAccount("$G");
var first = globalAccount.NewServiceReply(tracking: false);
var second = globalAccount.NewServiceReply(tracking: false);
var tracked = globalAccount.NewServiceReply(tracking: true);
first.Length.ShouldBeGreaterThan(20);
second.Length.ShouldBeGreaterThan(20);
first.SequenceEqual(second).ShouldBeFalse();
var trackedText = Encoding.ASCII.GetString(tracked);
trackedText.EndsWith(".T", StringComparison.Ordinal).ShouldBeTrue();
}
[Fact] // T:98
public void ImportSubscriptionPartialOverlapWithPrefix_ShouldSucceed()
{