Example #1
0
        public void Should_not_be_expired_when_expiration_not_set()
        {
            var outboxMessage = new OutboxMessage(
                this.Message.MessageType,
                this.MessageBytes,
                this.SerializedMessageMetaData,
                DateTime.UtcNow
                );

            outboxMessage.IsExpired(DateTime.MinValue).ShouldBeFalse();
            outboxMessage.IsExpired(DateTime.MaxValue).ShouldBeFalse();
        }
Example #2
0
        public void Should_calculate_expired_when_expiration_set()
        {
            var expiresAt = new DateTime(2019, 6, 3, 8, 0, 0, DateTimeKind.Utc);

            var outboxMessage = new OutboxMessage(
                this.Message.MessageType,
                this.MessageBytes,
                this.SerializedMessageMetaData,
                DateTime.UtcNow,
                false,
                expiresAt
                );

            outboxMessage.ExpiresAtUtc.ShouldBe(expiresAt);
            outboxMessage.IsExpired(expiresAt.AddMilliseconds(-1)).ShouldBeFalse();
            outboxMessage.IsExpired(expiresAt).ShouldBeTrue();
            outboxMessage.IsExpired(expiresAt.AddMilliseconds(1)).ShouldBeTrue();
        }