Created
December 8, 2011 06:08
-
-
Save samoshkin/1446254 to your computer and use it in GitHub Desktop.
tdd-time-to-live-class-tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestFixture] | |
public class TimeToLiveTests | |
{ | |
[Test] | |
public void never_expiring_ttl_should_not_expire_at_relative_time() | |
{ | |
TimeToLive.CreateNeverExpiring().ExpiresAtRelativeTime.Should().BeFalse(); | |
} | |
[Test] | |
public void never_expiring_ttl_should_not_expire_at_absolute_time() | |
{ | |
TimeToLive.CreateNeverExpiring().ExpiresAtAbsoluteTime.Should().BeFalse(); | |
} | |
[Test] | |
public void never_expiring_ttl_should_fail_to_get_expires_at_value() | |
{ | |
TimeToLive.CreateNeverExpiring().Invoking(ttl => { var validFor = ttl.ExpiresAt; }) | |
.ShouldThrow<InvalidOperationException>() | |
.WithMessage("instance is not configured to expire at a specific moment in future", ComparisonMode.Substring); | |
} | |
[Test] | |
public void never_expiring_ttl_should_equal_to_another_never_expiring_instance_of_ttl() | |
{ | |
var neverExpiringTtl = TimeToLive.CreateNeverExpiring(); | |
neverExpiringTtl.Should().Be(TimeToLive.CreateNeverExpiring()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment