IW4M-Admin/Tests/ApplicationTests/Mocks/EventHandler.cs
RaidMax 58bfd189d0 [issue #126]
implement basic run-as functionality
2020-04-26 21:12:49 -05:00

29 lines
679 B
C#

using SharedLibraryCore;
using SharedLibraryCore.Interfaces;
using System.Collections.Generic;
namespace ApplicationTests.Mocks
{
class MockEventHandler : IEventHandler
{
public IList<GameEvent> Events = new List<GameEvent>();
private readonly bool _autoExecute;
public MockEventHandler(bool autoExecute = false)
{
_autoExecute = autoExecute;
}
public void AddEvent(GameEvent gameEvent)
{
Events.Add(gameEvent);
if (_autoExecute)
{
gameEvent.Owner?.ExecuteEvent(gameEvent);
gameEvent.Complete();
}
}
}
}