using System.Collections.Generic; using System.Threading.Tasks; using Util.Events.Tests.Samples; using Xunit; namespace Util.Events.Tests.Local; /// /// 本地事件总线扩展测试 /// public class EventBusExtensionsTest { /// /// 本地事件总线 /// private readonly ILocalEventBus _eventBus; /// /// 测试初始化 /// public EventBusExtensionsTest( ILocalEventBus eventBus ) { _eventBus = eventBus; } /// /// 测试发布事件集合 /// [Fact] public async Task TestPublishAsync() { var event1 = new EventSample { Value = "a" }; var event2 = new EventSample2(); var event3 = new EventSample3(); var events = new List { event1, event2, event3 }; await _eventBus.PublishAsync( events ); Assert.Equal( "1:a", event1.Result ); Assert.Equal( "23", event2.Result ); Assert.Equal( "54", event3.Result ); } }