mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-10 15:20:48 -05:00
add configurable command and broadcast command prefix for issue #149
This commit is contained in:
@ -57,7 +57,8 @@ namespace ApplicationTests
|
||||
.Returns(new Command[]
|
||||
{
|
||||
new ImpersonatableCommand(cmdConfig, transLookup),
|
||||
new NonImpersonatableCommand(cmdConfig, transLookup)
|
||||
new NonImpersonatableCommand(cmdConfig, transLookup),
|
||||
new MockCommand(cmdConfig, transLookup)
|
||||
});
|
||||
|
||||
A.CallTo(() => manager.AddEvent(A<GameEvent>.Ignored))
|
||||
@ -519,5 +520,22 @@ namespace ApplicationTests
|
||||
Assert.IsNotEmpty(mockEventHandler.Events.Where(_event => _event.Type == GameEvent.EventType.ChangePermission && !_event.Failed));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region PREFIX_PROCESSING
|
||||
[Test]
|
||||
public async Task Test_CommandProcessing_IsBroadcastCommand()
|
||||
{
|
||||
string broadcastPrefix = "@@";
|
||||
var config = ConfigurationGenerators.CreateApplicationConfiguration();
|
||||
config.BroadcastCommandPrefix = broadcastPrefix;
|
||||
var server = serviceProvider.GetRequiredService<IW4MServer>();
|
||||
|
||||
var cmd = EventGenerators.GenerateEvent(GameEvent.EventType.Command, $"{broadcastPrefix}{nameof(MockCommand)}", server);
|
||||
|
||||
var result = await CommandProcessing.ValidateCommand(cmd, config);
|
||||
Assert.AreEqual(nameof(MockCommand), result.Name);
|
||||
Assert.IsTrue(result.IsBroadcast);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user