public void Add_throws_if_request_is_null()
        {
            // arrange
            var queue = new MarketDataRequestQueue();

            // act
            Assert.Throws<ArgumentNullException>(() => queue.Add(null));
        }
        public void Convert_throws_PossiblyPoisonMessageException_if_cant_deserialize()
        {
            var queue = new MarketDataRequestQueue();
            var message = new Amazon.SQS.Model.Message
                              {
                                  Body = "some garbage",
                              };

            Assert.Throws<PossiblyPoisonMessageException>(() => queue.Convert(message));
        }
        public void Add_throws_if_identifier_is_null()
        {
            // arrange
            var queue = new MarketDataRequestQueue();
            var request = new InstrumentMarketDataRequest
            {
                Identifier = null,
                StartDate = DateTime.Now.AddDays(-1),
                EndDate = DateTime.Now.AddDays(-1),
            };

            // act
            Assert.Throws<Exception>(() => queue.Add(request));
        }
        public void Add_does_not_throw_exception()
        {
            // arrange
            var queue = new MarketDataRequestQueue();
            var request = new InstrumentMarketDataRequest
                              {
                                  Identifier = "SBUX",
                                  StartDate = DateTime.Now.AddDays(-1),
                                  EndDate = DateTime.Now.AddDays(-1),
                              };

            // act
            queue.Add(request);
        }
        public void PossiblyPoisonMessageException_contains_original_messageid()
        {
            var messageId = "baz bat";
            var queue = new MarketDataRequestQueue();
            var message = new Amazon.SQS.Model.Message
            {
                Body = "some garbage",
                MessageId = messageId,
            };

            try
            {
                queue.Convert(message);
            }
            catch (PossiblyPoisonMessageException ppme)
            {
                Assert.That(ppme.MessageId, Is.EqualTo(messageId));
                return;
            }

            Assert.Fail("Should not have gotten this far in the test!");
        }