IW4M-Admin/Tests/ApplicationTests/Mocks/EventHandlerMock.cs
RaidMax d3d1f31ee0 bugfixes/enhancements
prevent users from trying to set the console's level to owner
fix issue with setting multiple owners
update/improve unit tests
2020-05-16 11:54:01 -05:00

29 lines
700 B
C#

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();
}
}
}
}