feat(runtime): share chat commands and run login sequence
This commit is contained in:
parent
5535d0adac
commit
41b15efd4d
57 changed files with 1739 additions and 345 deletions
|
|
@ -6,12 +6,54 @@ using AcDream.Core.Items;
|
|||
using AcDream.Core.Net.Messages;
|
||||
using AcDream.Core.Social;
|
||||
using AcDream.Runtime.Gameplay;
|
||||
using AcDream.Runtime;
|
||||
using AcDream.Runtime.Session;
|
||||
using AcDream.UI.Abstractions;
|
||||
|
||||
namespace AcDream.App.Tests.Net;
|
||||
|
||||
public sealed class LiveSessionCommandRouterTests
|
||||
{
|
||||
[Fact]
|
||||
public void LoginCommandSequenceUsesTheIdenticalGraphicalCommandSurface()
|
||||
{
|
||||
using var communication = new RuntimeCommunicationState();
|
||||
var calls = new List<string>();
|
||||
ClientCommandController.Bindings client = NewClientBindings() with
|
||||
{
|
||||
QueryAge = () => calls.Add("client:age"),
|
||||
};
|
||||
var router = NewRouter(
|
||||
chat: communication.Chat,
|
||||
turbine: communication.TurbineChat,
|
||||
communication: communication,
|
||||
clientBindings: client,
|
||||
sendTalk: text => calls.Add($"talk:{text}"),
|
||||
sendTell: (target, text) =>
|
||||
calls.Add($"tell:{target}:{text}"),
|
||||
sendChannel: (channel, text) =>
|
||||
calls.Add($"channel:{channel:X8}:{text}"));
|
||||
var surface = new LiveSessionCommandSurface();
|
||||
using ILiveSessionCommandRouting lease = surface.Attach(router);
|
||||
lease.Activate();
|
||||
var sequence = new LoginCommandSequence(
|
||||
["hello", "/tell Bob, secret", "@admin raw", "/age"],
|
||||
TimeSpan.Zero,
|
||||
new RuntimeChatCommandFeedback(communication),
|
||||
surface);
|
||||
|
||||
sequence.EnteredWorld(new RuntimeGenerationToken(9));
|
||||
|
||||
Assert.Equal(
|
||||
[
|
||||
"talk:hello",
|
||||
"tell:Bob:secret",
|
||||
"channel:00000002:raw",
|
||||
"client:age",
|
||||
],
|
||||
calls);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InactiveAndDisposedRouter_CannotReachTransport()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue