コード例 #1
0
        public void cant_get_non_existent_subscription()
        {
            var channel            = Substitute.For <ITcpChannel>();
            var transactionManager = Substitute.For <ITransactionManager>();

            var    sut    = new StompClient(channel, transactionManager);
            Action actual = () => sut.GetSubscription("abc");

            actual.ShouldThrow <NotFoundException>();
        }
コード例 #2
0
        public void get_existent_subscription()
        {
            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("SEND");

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

            var sut = new StompClient(channel, transactionManager);

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

            actual.Should().BeSameAs(subscription);
        }