2020-04-21 18:34:00 -04:00
|
|
|
|
using SharedLibraryCore;
|
|
|
|
|
using SharedLibraryCore.Interfaces;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace ApplicationTests.Mocks
|
|
|
|
|
{
|
2020-05-16 12:54:01 -04:00
|
|
|
|
class EventHandlerMock : IEventHandler
|
2020-04-21 18:34:00 -04:00
|
|
|
|
{
|
|
|
|
|
public IList<GameEvent> Events = new List<GameEvent>();
|
2020-04-26 22:12:49 -04:00
|
|
|
|
private readonly bool _autoExecute;
|
|
|
|
|
|
2020-05-16 12:54:01 -04:00
|
|
|
|
public EventHandlerMock(bool autoExecute = false)
|
2020-04-26 22:12:49 -04:00
|
|
|
|
{
|
|
|
|
|
_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
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|