コード例 #1
0
        public void SetQosPreFetchLimit()
        {
            ushort expected = 1000;
            RabbitPublisherBuilder outSubject = subject.SetQosPreFetchLimit(expected);

            Assert.IsNotNull(outSubject);
            Assert.AreEqual(expected, outSubject.QosPreFetchLimit);
        }
コード例 #2
0
        public void Build_SetConfirmPublish()
        {
            subject = subject.SetConfirmPublish();

            VerifyBuild();

            mockChannel.Verify(c => c.ConfirmSelect());
        }
コード例 #3
0
        public void SetContentType()
        {
            RabbitPublisherBuilder actual = subject.SetContentType(expectedContentType);

            Assert.IsNotNull(actual);

            Assert.AreEqual(expectedContentType, actual.ContentType);
        }
コード例 #4
0
        public void UseClassicQueue()
        {
            RabbitPublisherBuilder actual = subject.UseQueueType(RabbitQueueType.classic);

            Assert.AreEqual(subject, actual);

            Assert.AreEqual(subject.QueueArguments["x-queue-type"], "classic");
        }
コード例 #5
0
        public void SetLazyQueue()
        {
            Assert.IsFalse(subject.IsLazyQueues);
            // args.put("x-queue-mode", "lazy");
            RabbitPublisherBuilder actual = subject.SetLazyQueue();

            Assert.IsTrue(subject.IsLazyQueues);

            Assert.IsNotNull(actual);
            Assert.AreEqual("lazy", subject.QueueArguments["x-queue-mode"]);

            subject = subject.UseQueueType(RabbitQueueType.quorum);
            Assert.IsTrue(subject.IsLazyQueues);
            Assert.IsFalse(subject.QueueArguments.Keys.Contains("x-queue-mode"));
            Assert.AreEqual("0", subject.QueueArguments["x-max-in-memory-length"]);
        }
コード例 #6
0
        public void InitializeRabbitConsumerBuilderTest()
        {
            expectedTuple = new Tuple <string, string>(expectedQueue, expectedRoutingKey);

            mockProperties      = new Mock <IBasicProperties>();
            this.mockCreator    = new Mock <IRabbitConnectionCreator>();
            this.mockConnection = new Mock <IConnection>();
            mockChannel         = new Mock <IModel>();


            this.mockConnection.Setup(c => c.CreateModel()).Returns(mockChannel.Object);


            mockChannel.Setup(c => c.CreateBasicProperties()).Returns(mockProperties.Object);
            this.mockCreator.Setup(c => c.GetConnection()).Returns(mockConnection.Object);
            this.mockCreator.Setup(c => c.GetChannel()).Returns(mockChannel.Object);

            subject = new RabbitPublisherBuilder(mockCreator.Object, expectedPreFetchLimit);
        }