コード例 #1
0
        public void SendMessage()
        {
            var message = new TestMessageA();

             this.componentUnderTest.Send(message);

             A.CallTo(() => this.MessageServiceExchange.Enqueue(message)).MustHaveHappened(Repeated.Exactly.Once);
        }
コード例 #2
0
        public void ShouldReturnNullIfDifferentMessageQueued()
        {
            var message = new TestMessageA();
             this.componentUnderTest.Enqueue(message);

             var result = this.componentUnderTest.Dequeue(typeof(TestMessageB), 0);

             Assert.That(result, Is.Null);
        }
コード例 #3
0
        public void DequeueSingleMessage()
        {
            var message = new TestMessageA();
             this.componentUnderTest.Enqueue(message);

             var result = this.componentUnderTest.Dequeue(typeof(TestMessageA), 0);

             Assert.That(result, Is.SameAs(message));
        }
        public void InvokeIndividualInvokerToHandleMessage()
        {
            var testMessage = new TestMessageA();
             var invoker = A.Fake<IMessageHandlerInvoker>();
             A.CallTo(() => this.messageHandlerInvokerFactory.CreateIndividual(A<Type>._, A<Type>._)).Returns(invoker);

             this.componentUnderTest.Handle(testMessage);

             A.CallTo(() => invoker.Handle(testMessage)).MustHaveHappened(Repeated.Exactly.Once);
        }
コード例 #5
0
        public void CreateInstanceOfInvokeThatInvokesHandler()
        {
            var message = new TestMessageA();
             var handler = new TestMessageAHandler();
             A.CallTo(() => this.serviceBusResolver.Resolve<TestMessageAHandler>()).Returns(handler);

             var invoker = this.componentUnderTest.CreateIndividual(typeof(TestMessageAHandler), typeof(TestMessageA));
             invoker.Handle(message);

             Assert.That(handler.LastMessageHandled, Is.SameAs(message));
        }
コード例 #6
0
        public void DequeueLastMessageOfTypeB()
        {
            var messageA = new TestMessageA();
             var messageB = new TestMessageB();
             this.componentUnderTest.Enqueue(messageA);
             this.componentUnderTest.Enqueue(messageB);

             var result = this.componentUnderTest.Dequeue(typeof(TestMessageB), 0);

             Assert.That(result, Is.SameAs(messageB));
        }
コード例 #7
0
        public async void ShouldSend()
        {
            //Arrange
            var msg = new TestMessageA()
            {
                Id = Guid.NewGuid().ToString()
            };

            using var queue = SqsThreadSafeBuilder.Build <TestMessageA>();
            Task send() => queue.Send(msg);

            //Act
            await send();

            //Assert
            Assert.False(send().IsFaulted);
        }
コード例 #8
0
        public void SerialiseMessage()
        {
            var message = new TestMessageA();
             this.componentUnderTest.Send(message);

             A.CallTo(() => this.MessageSerialiser.Serialise(message)).MustHaveHappened(Repeated.Exactly.Once);
        }
コード例 #9
0
 public TestAggregateSnapshot(TestMessageA testMessageA)
 {
     this.TestMessageA = testMessageA;
 }