Esempio n. 1
0
        protected override void Given()
        {
            var queue = CreateSuccessfulTestQueue(Guid.NewGuid().ToString(), new TestMessage());

            _sqsClient = queue.FakeClient;

            Queues.Add(queue);
            Handler.ShouldSucceed = false;
        }
Esempio n. 2
0
        protected static FakeSqsQueue CreateSuccessfulTestQueue(
            string queueName,
            Func <IEnumerable <ReceiveMessageResponse> > getMessages)
        {
            var fakeClient = new FakeAmazonSqs(getMessages);

            var sqsQueue = new FakeSqsQueue(queueName,
                                            fakeClient);

            return(sqsQueue);
        }
        protected override void Given()
        {
            var queue = CreateSuccessfulTestQueue(Guid.NewGuid().ToString(),
                                                  () => new List <Message> {
                new TestMessage {
                    Body = _messageBody
                }
            });

            _sqsClient = queue.FakeClient;

            Queues.Add(queue);
        }
Esempio n. 4
0
        protected override void Given()
        {
            var queue = CreateSuccessfulTestQueue("TestQueue", new TestMessage());

            _sqsClient = queue.FakeClient;

            Queues.Add(queue);

            Handler.OnHandle = (msg) =>
            {
                if (!_firstTime)
                {
                    return;
                }

                _firstTime = false;
                throw new TestException("Thrown by test handler");
            };
        }
        protected override void Given()
        {
            // we expect to get max 10 messages per batch
            _expectedMaxMessageCount = MessageDefaults.MaxAmazonMessageCap;

            Logger.LogInformation("Expected max message count is {MaxMessageCount}", _expectedMaxMessageCount);

            var response1 = new List <Message> {
                new Message {
                    Body = AttributeMessageContentsRunning
                }
            };
            var response2 = new List <Message> {
                new Message {
                    Body = AttributeMessageContentsAfterStop
                }
            };

            _queue  = CreateSuccessfulTestQueue(Guid.NewGuid().ToString(), () => _running ? response1 : response2);
            _client = _queue.FakeClient;

            Queues.Add(_queue);
        }