Skip to content

Instantly share code, notes, and snippets.

@samoshkin
Created December 8, 2011 06:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samoshkin/1446254 to your computer and use it in GitHub Desktop.
Save samoshkin/1446254 to your computer and use it in GitHub Desktop.
tdd-time-to-live-class-tests
[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