public async Task Broadcast_CanBroadcastEvent_ToMultipleHandlers()
        {
            var invokedCt = 0;
            var eventName = "Test.Event";
            var handler1  = new Mock <IEventHandler>();

            handler1.Setup(x => x.EventName).Returns(eventName);
            handler1.Setup(x => x.Handle)
            .Returns(args =>
            {
                invokedCt++;
                return(Task.CompletedTask);
            });

            var handler2 = new Mock <IEventHandler>();

            handler2.Setup(x => x.EventName).Returns(eventName);
            handler2.Setup(x => x.Handle)
            .Returns(args =>
            {
                invokedCt++;
                return(Task.CompletedTask);
            });
            var broadcaster = new EventBroadcaster(new List <IEventHandler> {
                handler1.Object, handler2.Object
            });

            await broadcaster.BroadcastAsync(eventName, "testarg");

            Assert.AreEqual(invokedCt, 2);
        }
        public async Task Broadcast_CanBroadcastEvent_ToSingleHandler()
        {
            object[] passedArgouments = null;
            var      eventName        = "Test.Event";
            var      handler          = new Mock <IEventHandler>();

            handler.Setup(x => x.EventName).Returns(eventName);
            handler.Setup(x => x.Handle)
            .Returns(args =>
            {
                passedArgouments = args;
                return(Task.CompletedTask);
            });
            var broadcaster = new EventBroadcaster(new List <IEventHandler> {
                handler.Object
            });

            await broadcaster.BroadcastAsync(eventName, new object[] { "arg1" });

            Assert.IsNotNull(passedArgouments);
            Assert.AreEqual(passedArgouments.Count(), 1);
            Assert.AreEqual(passedArgouments[0], "arg1");
        }