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
60
tests/AcDream.Runtime.Tests/Chat/ChatExtractionTests.cs
Normal file
60
tests/AcDream.Runtime.Tests/Chat/ChatExtractionTests.cs
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
using System.Reflection;
|
||||
using AcDream.Runtime.Chat;
|
||||
|
||||
namespace AcDream.Runtime.Tests.Chat;
|
||||
|
||||
public sealed class ChatExtractionTests
|
||||
{
|
||||
[Fact]
|
||||
public void CompleteChatCoreLivesInRuntimeAssembly()
|
||||
{
|
||||
Assembly runtime = typeof(GameRuntime).Assembly;
|
||||
Type[] extracted =
|
||||
[
|
||||
typeof(ChatInputParser),
|
||||
typeof(ChatCommandRouter),
|
||||
typeof(RetailClientCommandCatalog),
|
||||
typeof(RetailCommandHelpTable),
|
||||
typeof(RetailChannelTagTable),
|
||||
typeof(ChannelResolver),
|
||||
typeof(ICommandBus),
|
||||
typeof(LiveCommandBus),
|
||||
typeof(NullCommandBus),
|
||||
typeof(ChatChannelKind),
|
||||
typeof(ClientCommandId),
|
||||
typeof(SendChatCmd),
|
||||
typeof(SendServerCommandCmd),
|
||||
typeof(SendRawChannelCmd),
|
||||
typeof(ExecuteClientCommandCmd),
|
||||
];
|
||||
|
||||
Assert.All(extracted, type => Assert.Same(runtime, type.Assembly));
|
||||
Assert.DoesNotContain(
|
||||
runtime.GetReferencedAssemblies(),
|
||||
reference => reference.Name is "AcDream.App"
|
||||
or "AcDream.UI.Abstractions");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RouterDependsOnlyOnTheFourMemberFeedbackContract()
|
||||
{
|
||||
string[] members = typeof(IChatCommandFeedback)
|
||||
.GetMembers(BindingFlags.Instance | BindingFlags.Public)
|
||||
.Where(static member => member.MemberType is
|
||||
MemberTypes.Method or MemberTypes.Property)
|
||||
.Where(static member => member is not MethodInfo method
|
||||
|| !method.IsSpecialName)
|
||||
.Select(static member => member.Name)
|
||||
.Order(StringComparer.Ordinal)
|
||||
.ToArray();
|
||||
|
||||
Assert.Equal(
|
||||
[
|
||||
"LastIncomingTellSender",
|
||||
"LastOutgoingTellTarget",
|
||||
"ShowInterfaceText",
|
||||
"ShowSystemMessage",
|
||||
],
|
||||
members);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue