Exemplo n.º 1
0
        public void DisposeUnregistersMessageCallback()
        {
            var chMock = new Mock<IMqttConnectionHandler>();
            chMock.Setup((x) => x.RegisterForMessage(MqttMessageType.SubscribeAck, It.IsAny<Func<MqttMessage, bool>>()));
            chMock.Setup((x) => x.UnRegisterForMessage(MqttMessageType.SubscribeAck, It.IsAny<Func<MqttMessage, bool>>()));

            Nmqtt.SubscriptionsManager subMgr = new Nmqtt.SubscriptionsManager(chMock.Object);
            subMgr.Dispose();

            chMock.VerifyAll();
        }
Exemplo n.º 2
0
        public void Ctor()
        {
            var chMock  = new Mock <IMqttConnectionHandler>();
            var pubMock = new Mock <IPublishingManager>();

            chMock.Setup(x => x.RegisterForMessage(MqttMessageType.SubscribeAck, It.IsAny <Func <MqttMessage, bool> >()));

            var sub = new Nmqtt.SubscriptionsManager(chMock.Object, pubMock.Object);

            chMock.VerifyAll();
            sub.Dispose();
        }
Exemplo n.º 3
0
        public void Ctor()
        {
            var chMock = new Mock<IMqttConnectionHandler>();
            var pubMock = new Mock<IPublishingManager>();

            chMock.Setup(x => x.RegisterForMessage(MqttMessageType.SubscribeAck, It.IsAny<Func<MqttMessage, bool>>()));

            var sub = new Nmqtt.SubscriptionsManager(chMock.Object, pubMock.Object);
            
            chMock.VerifyAll();
            sub.Dispose();
        }
Exemplo n.º 4
0
        public void DisposeUnregistersMessageCallback()
        {
            var chMock = new Mock <IMqttConnectionHandler>();

            chMock.Setup((x) => x.RegisterForMessage(MqttMessageType.SubscribeAck, It.IsAny <Func <MqttMessage, bool> >()));
            chMock.Setup((x) => x.UnRegisterForMessage(MqttMessageType.SubscribeAck, It.IsAny <Func <MqttMessage, bool> >()));

            Nmqtt.SubscriptionsManager subMgr = new Nmqtt.SubscriptionsManager(chMock.Object);
            subMgr.Dispose();

            chMock.VerifyAll();
        }
Exemplo n.º 5
0
        /// <summary>
        ///     Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        public void Dispose()
        {
            if (keepAlive != null)
            {
                keepAlive.Dispose();
            }

            if (subscriptionsManager != null)
            {
                subscriptionsManager.Dispose();
            }

            if (messageLogger != null)
            {
                messageLogger.Dispose();
            }

            if (connectionHandler != null)
            {
                connectionHandler.Dispose();
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        public void Dispose()
        {
            if (keepAlive != null)
            {
                keepAlive.Dispose();
            }

            if (subscriptionsManager != null)
            {
                subscriptionsManager.Dispose();
            }

            if (messageLogger != null)
            {
                messageLogger.Dispose();
            }

            if (connectionHandler != null)
            {
                connectionHandler.Dispose();
            }

            GC.SuppressFinalize(this);
        }