Esempio n. 1
0
        public void ack_messages_can_ack_all_since_we_dont_allow_multiple_pending_messages_with_client_individual_ack_type()
        {
            var channel            = Substitute.For <ITcpChannel>();
            var transactionManager = Substitute.For <ITransactionManager>();
            var client             = Substitute.For <IStompClient>();
            var subscription       = new Subscription(client, "abc");

            subscription.AckType = "client";
            var frame1 = new BasicFrame("MESSAGE");

            frame1.AddHeader("message-id", "kdkd1");
            var frame2 = new BasicFrame("MESSAGE");

            frame2.AddHeader("message-id", "kdkd2");
            var frame3 = new BasicFrame("MESSAGE");

            frame3.AddHeader("message-id", "kdkd3");
            subscription.Send(frame1);
            subscription.Send(frame2);
            subscription.Send(frame3);

            var sut = new StompClient(channel, transactionManager);

            sut.AddSubscription(subscription);
            sut.AckMessages("kdkd2");
            var actual1 = sut.IsFramePending("kdkd1");
            var actual2 = sut.IsFramePending("kdkd2");
            var actual3 = sut.IsFramePending("kdkd3");

            actual1.Should().BeFalse();
            actual2.Should().BeFalse();
            actual3.Should().BeTrue();
        }
Esempio n. 2
0
        public void sent_message_should_be_pending_using_client_ack_type()
        {
            var channel            = Substitute.For <ITcpChannel>();
            var transactionManager = Substitute.For <ITransactionManager>();
            var client             = Substitute.For <IStompClient>();
            var subscription       = new Subscription(client, "abc");
            var frame = new BasicFrame("MESSAGE");

            frame.AddHeader("message-id", "kdkd");
            subscription.AckType = "client";
            subscription.Send(frame);

            var sut = new StompClient(channel, transactionManager);

            sut.AddSubscription(subscription);
            var actual = sut.IsFramePending("kdkd");

            actual.Should().BeTrue();
        }