public async Task AllMessagesAreClearedFromQueue()
        {
            await Patiently.VerifyExpectationAsync(
                () => SerialisationRegister.Received(2).DeserializeMessage(
                    Arg.Any<string>()));

            await Patiently.VerifyExpectationAsync(
                () =>Sqs.Received().DeleteMessage(
                    Arg.Any<DeleteMessageRequest>()));
        }
        protected override void Given()
        {
            Sqs                   = Substitute.For <IAmazonSQS>();
            Serialiser            = Substitute.For <IMessageSerialiser>();
            SerialisationRegister = Substitute.For <IMessageSerialisationRegister>();
            Monitor               = Substitute.For <IMessageMonitor>();
            Handler               = Substitute.For <IHandler <GenericMessage> >();
            GenerateResponseMessage(_messageTypeString, Guid.NewGuid());

            SerialisationRegister.GeTypeSerialiser(_messageTypeString).Returns(new TypeSerialiser(typeof(GenericMessage), Serialiser));
            DeserialisedMessage = new GenericMessage {
                RaisingComponent = "Component"
            };
            Serialiser.Deserialise(Arg.Any <string>(), typeof(GenericMessage)).Returns(x => DeserialisedMessage);
            Sqs.When(x => x.ReceiveMessage(Arg.Any <ReceiveMessageRequest>()))
            .Do(_ =>
            {
                _sqsCallCounter++;
                throw new Exception();
            });
        }
Ejemplo n.º 3
0
 protected override void Given()
 {
     TestWaitTime = 100;
     base.Given();
     SerialisationRegister.GetSerialiser(Arg.Any <string>()).Returns(x => { throw new KeyNotFoundException(); });
 }
        public void AllMessagesAreClearedFromQueue()
        {
            SerialisationRegister.Received(2).DeserializeMessage(Arg.Any <string>());

            Sqs.Received().DeleteMessageAsync(Arg.Any <DeleteMessageRequest>());
        }
 public void MessagesGetDeserialisedByCorrectHandler()
 {
     SerialisationRegister.Received().DeserializeMessage(
         SqsMessageBody(MessageTypeString));
 }
Ejemplo n.º 6
0
 public void MessageIsProcessed()
 {
     SerialisationRegister.Received().DeserializeMessage(
         BodyOfMessageAfterStop);
 }
Ejemplo n.º 7
0
 public async Task MessagesGetDeserialisedByCorrectHandler()
 {
     await Patiently.VerifyExpectationAsync(
         () => SerialisationRegister.Received().DeserializeMessage(
             SqsMessageBody(_messageTypeString)));
 }
Ejemplo n.º 8
0
 public async Task MessageIsProcessed()
 {
     await Patiently.VerifyExpectationAsync(() =>
                                            SerialisationRegister.Received().DeserializeMessage(
                                                BodyOfMessageAfterStop));
 }
Ejemplo n.º 9
0
 public void MessageIsProcessed()
 {
     Patiently.VerifyExpectation(() => SerialisationRegister.Received().GetSerialiser(SubjectOfMessageAfterStop));
 }