Example #1
0
        public void when_item_is_not_specified()
        {
            Action creation = () => new StoreCommand(null, TimeToLive.CreateNeverExpiring(), 1);

            creation
            .ShouldThrow <ArgumentException>()
            .WithMessage("When storing item, item should be specified.", ComparisonMode.Substring);
        }
Example #2
0
        public void when_items_value_is_not_specified()
        {
            Action creation = () => new StoreCommand(new CacheItem(), TimeToLive.CreateNeverExpiring(), 1);

            creation
            .ShouldThrow <ArgumentException>()
            .WithMessage("item's value should be specified", ComparisonMode.Substring);
        }
Example #3
0
        public void when_specifying_check_and_set_store_mode()
        {
            Action creation = () => new StoreCommand(new CacheItem {
                Data = 1
            }, TimeToLive.CreateNeverExpiring(), StoreMode.CheckAndSet);

            creation
            .ShouldThrow <ArgumentException>()
            .WithMessage("To initialize 'Check and Set' command use another constructor, which accepts unique ID.", ComparisonMode.Substring);
        }
Example #4
0
 public void should_equal_to_another_never_expiring_instance_of_time_to_live()
 {
     timeToLive.Should().Be(TimeToLive.CreateNeverExpiring());
 }
Example #5
0
 public void should_not_equal_to_time_to_live_which_never_expiring_or_expire_at_absolute_time()
 {
     timeToLive.Should().NotBe(TimeToLive.CreateNeverExpiring());
     timeToLive.Should().NotBe(TimeToLive.CreateExpiringAt(new DateTime(2011, 1, 1)));
 }
Example #6
0
 public when_time_to_live_is_set_as_never_expiring()
 {
     Given(() => timeToLive = TimeToLive.CreateNeverExpiring());
 }
Example #7
0
 public void should_not_equal_to_time_to_live_which_never_expiring_or_expire_at_relative_time()
 {
     timeToLive.Should().NotBe(TimeToLive.CreateNeverExpiring());
     timeToLive.Should().NotBe(TimeToLive.CreateValidFor(TimeSpan.FromSeconds(2)));
 }