mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-15 17:50:19 -05:00
bugfixes/enhancements
prevent users from trying to set the console's level to owner fix issue with setting multiple owners update/improve unit tests
This commit is contained in:
28
Tests/ApplicationTests/Mocks/EventHandlerMock.cs
Normal file
28
Tests/ApplicationTests/Mocks/EventHandlerMock.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ApplicationTests.Mocks
|
||||
{
|
||||
class EventHandlerMock : IEventHandler
|
||||
{
|
||||
public IList<GameEvent> Events = new List<GameEvent>();
|
||||
private readonly bool _autoExecute;
|
||||
|
||||
public EventHandlerMock(bool autoExecute = false)
|
||||
{
|
||||
_autoExecute = autoExecute;
|
||||
}
|
||||
|
||||
public void HandleEvent(IManager manager, GameEvent gameEvent)
|
||||
{
|
||||
Events.Add(gameEvent);
|
||||
|
||||
if (_autoExecute)
|
||||
{
|
||||
gameEvent.Owner?.ExecuteEvent(gameEvent);
|
||||
gameEvent.Complete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user