コード例 #1
0
        public void send_by_delay()
        {
            var theMessage = new Message1();

            ClassUnderTest.DelaySend(theMessage, 5.Hours());

            theLastEnvelopeSent.Message.ShouldBeTheSameAs(theMessage);
            theLastEnvelopeSent.ExecutionTime.ShouldBe(UtcSystemTime.AddHours(5));
        }
        public void absolute_expiration()
        {
            theSettings.SlidingExpiration = false;

            theTicket.Expiration = UtcSystemTime.AddMinutes(1);
            ClassUnderTest.IsExpired(theTicket).ShouldBeFalse();

            theTicket.Expiration = UtcSystemTime;
            ClassUnderTest.IsExpired(theTicket).ShouldBeTrue();

            theTicket.Expiration = UtcSystemTime.AddMinutes(-1);
            ClassUnderTest.IsExpired(theTicket).ShouldBeTrue();
        }
        public void sliding_expiration()
        {
            theSettings.SlidingExpiration = true;
            theSettings.ExpireInMinutes   = 30;

            theTicket.LastAccessed = UtcSystemTime;
            ClassUnderTest.IsExpired(theTicket).ShouldBeFalse();

            theTicket.LastAccessed = UtcSystemTime.AddMinutes(-10);
            ClassUnderTest.IsExpired(theTicket).ShouldBeFalse();

            theTicket.LastAccessed = UtcSystemTime.AddMinutes(-30);
            ClassUnderTest.IsExpired(theTicket).ShouldBeTrue();

            theTicket.LastAccessed = UtcSystemTime.AddMinutes(-40);
            ClassUnderTest.IsExpired(theTicket).ShouldBeTrue();
        }
        public void expiration_is_now_plus_the_expiration_in_minutes_from_settings()
        {
            var expirationTime = UtcSystemTime.AddMinutes(30);

            theResultingTicket.Expiration.ShouldEqual(expirationTime);
        }