Example #1
0
        public void GetSqsMessageDelaySeconds_VariousEnvironmentSettings_ReturnsCorrectDelay(int?value, int expectedReturn)
        {
            Environment.SetEnvironmentVariable("SQS_MESSAGE_DELAY", value?.ToString());
            var handler = HandlerTestDouble.HandlerTestDoubleFactory();

            handler.GetSqsMessageDelaySeconds().Should().Be(expectedReturn);
        }
Example #2
0
        public void GetSqsMessageDelaySeconds_InvalidEnvironmentSetting_ReturnsMinimumDelayAndLogsMessage()
        {
            Environment.SetEnvironmentVariable("SQS_MESSAGE_DELAY", "invalid-will-throw-exception");
            var handler = HandlerTestDouble.HandlerTestDoubleFactory();

            handler.GetSqsMessageDelaySeconds().Should().Be(600);
            handler.LastError.Should().Be("SQS_MESSAGE_DELAY either not found or not an integer, using default of 600s");
        }
Example #3
0
        public void MessageTimingIsValid_ValidTimings_ReturnsTrue(int timeDelaySeconds)
        {
            var message = new SqsMessage()
            {
                taskId      = "test",
                newIndex    = "test",
                alias       = "test",
                timeCreated = DateTime.Now.AddSeconds(-timeDelaySeconds)
            };

            var handler = HandlerTestDouble.HandlerTestDoubleFactory();

            handler.MessageTimingIsValid(message).Should().Be(true);
        }