elsa-core/test/integration/Elsa.ServiceBusIntegrationTests/Helpers/TestResetEventManager.cs
jdevillard fb68814974
Service Bus Activities enhancements - Workflow Inbox and Test (#4512)
* Add Service Bus Message Test Scenario

* change filename

* add workflow test

* save new unit test project (don't know why Guid have changed

* use WorkfloInbox Message for ReceiveActivity and Worker

* add test

* add correlationId

* add test with correlationId

* saving sln

* Fix project references

* remove Moq librairies for UnitTests Projects

* remove Moq and use NSubstitute

---------

Co-authored-by: Jérémie DEVILLARD <jdevillard@users.noreply.github.com>
Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
2023-10-19 20:00:43 +02:00

37 lines
1.1 KiB
C#

using Elsa.ServiceBusIntegrationTests.Contracts;
namespace Elsa.ServiceBusIntegrationTests.Helpers
{
public class TestResetEventManager : ITestResetEventManager
{
public AutoResetEvent WaitHandleTest { get; } = new AutoResetEvent(false);
private IDictionary<string, AutoResetEvent> _events = new Dictionary<string, AutoResetEvent>();
public AutoResetEvent Get()
{
return WaitHandleTest;
}
public AutoResetEvent Get(string resetEvent)
{
_events.TryGetValue(resetEvent, out var result);
return result;
}
public AutoResetEvent Init(string resetEvent)
{
var rEvent = Get(resetEvent);
if (rEvent == null)
{
var newEvent = new AutoResetEvent(false);
_events.Add(resetEvent, newEvent);
return newEvent;
}
return rEvent;
}
public void Set(string resetEvent)
{
Get(resetEvent)?.Set();
}
}
}