Exemple #1
0
        public void UnBind_ShouldUnbind()
        {
            // Arrange
            var service = new MessageBus();

            service.OnHandleMessageException += (e) => throw e;
            service.Bind <int>(Handler);
            service.UnBind <int>(Handler);

            // Act/Assert
            service.Send(1);

            void Handler(int _) => Assert.Fail("Not unbinded");
        }
Exemple #2
0
        public void UnBind_ShouldBindAndRecvMessage()
        {
            // Arrange
            var service = new MessageBus();

            service.OnHandleMessageException += (e) => throw e;
            service.Bind <int>(Handler);

            // Act/Assert
            service.Send(1);

            Assert.Fail("Not handled");

            void Handler(int _) => Assert.Pass("message handled");
        }
 public Task StartAsync(CancellationToken cancellationToken)
 {
     MessageBusSubscription = MessageBus.Bind(ManagedMqttClient);
     MqttEntityControlPanel.BindAll(MqttApplicationProvider, MessageBus, true);
     return(Task.CompletedTask);
 }