using Moli.Desktop.Runtime;
|
|
namespace Moli.Desktop.Tests.Runtime;
|
|
public class RuntimeEventBusTests
|
{
|
[Fact]
|
public async Task PublishAsync_DeliversEventToSubscriber()
|
{
|
var bus = new RuntimeEventBus();
|
RuntimeEvent? received = null;
|
|
using var subscription = bus.Subscribe(runtimeEvent =>
|
{
|
received = runtimeEvent;
|
return Task.CompletedTask;
|
});
|
|
await bus.PublishAsync(new RuntimeEvent { Name = "app.started" });
|
|
Assert.NotNull(received);
|
Assert.Equal("app.started", received.Name);
|
}
|
}
|