58bfd189d0
implement basic run-as functionality
29 lines
679 B
C#
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();
|
|
}
|
|
}
|
|
}
|
|
}
|