コード例 #1
0
        public void subscription_id_must_be_specified_according_to_the_specification()
        {
            var repos = Substitute.For<IQueueRepository>();
            var client = Substitute.For<IStompClient>();
            var msg = new BasicFrame("SUBSCRIBE");

            var sut = new SubscribeHandler(repos);
            Action actual = () => sut.Process(client, msg);

            actual.ShouldThrow<BadRequestException>();
        }
コード例 #2
0
        public void may_not_subscribe_on_previously_created_subscription()
        {
            var repos = Substitute.For<IQueueRepository>();
            var client = Substitute.For<IStompClient>();
            var msg = new BasicFrame("SUBSCRIBE");
            msg.Headers["id"] = "123";
            client.SubscriptionExists("123").Returns(true);

            var sut = new SubscribeHandler(repos);
            Action actual = () => sut.Process(client, msg);

            actual.ShouldThrow<BadRequestException>();
        }
コード例 #3
0
        public void successful_subcribe()
        {
            var repos = Substitute.For<IQueueRepository>();
            var client = Substitute.For<IStompClient>();
            var msg = new BasicFrame("SUBSCRIBE");
            msg.Headers["id"] = "123";
            msg.Headers["destination"] = "/queue/mamma";
            repos.Get("/queue/mamma").Returns(new StompQueue());

            var sut = new SubscribeHandler(repos);
            var actual = sut.Process(client, msg);

        
        }