2020-04-21 18:34:00 -04:00
|
|
|
|
using SharedLibraryCore;
|
|
|
|
|
using SharedLibraryCore.Interfaces;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace ApplicationTests.Mocks
|
|
|
|
|
{
|
|
|
|
|
class MockEventHandler : IEventHandler
|
|
|
|
|
{
|
|
|
|
|
public IList<GameEvent> Events = new List<GameEvent>();
|
2020-04-26 22:12:49 -04:00
|
|
|
|
private readonly bool _autoExecute;
|
|
|
|
|
|
|
|
|
|
public MockEventHandler(bool autoExecute = false)
|
|
|
|
|
{
|
|
|
|
|
_autoExecute = autoExecute;
|
|
|
|
|
}
|
2020-04-21 18:34:00 -04:00
|
|
|
|
|
2020-05-04 17:50:02 -04:00
|
|
|
|
public void HandleEvent(IManager manager, GameEvent gameEvent)
|
2020-04-21 18:34:00 -04:00
|
|
|
|
{
|
|
|
|
|
Events.Add(gameEvent);
|
2020-04-26 22:12:49 -04:00
|
|
|
|
|
|
|
|
|
if (_autoExecute)
|
|
|
|
|
{
|
|
|
|
|
gameEvent.Owner?.ExecuteEvent(gameEvent);
|
|
|
|
|
gameEvent.Complete();
|
|
|
|
|
}
|
2020-04-21 18:34:00 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|