public void SendMessage()
        {
            var message = new TestMessageA();

             this.componentUnderTest.Send(message);

             A.CallTo(() => this.MessageServiceExchange.Enqueue(message)).MustHaveHappened(Repeated.Exactly.Once);
        }
        public void ShouldReturnNullIfDifferentMessageQueued()
        {
            var message = new TestMessageA();
             this.componentUnderTest.Enqueue(message);

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

             Assert.That(result, Is.Null);
        }
        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);
        }
        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));
        }
        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));
        }
Beispiel #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);
        }
        public void SerialiseMessage()
        {
            var message = new TestMessageA();
             this.componentUnderTest.Send(message);

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