1
0
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:
RaidMax
2020-07-31 20:40:03 -05:00
parent fc20e78066
commit 51202e7f8b
27 changed files with 403 additions and 61 deletions

View File

@ -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
}
}