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); }