基于WebView2实现的Win11桌面框架,利用插件自定义
Moli
2026-05-02 93676d91a7c734cf6b2ace496142e69ccb037775
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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);
    }
}