Example #1
0
 public void random_item_cannot_be_retrieved_as_locked()
 {
     Assert.IsNull(
         _cache.TryGetAndLockPartitionState(
             "random", CheckpointTag.FromPosition(0, 200, 190)),
         "Cache should be empty");
 }
        the_first_partition_locked_before_the_unlock_position_cannot_be_retrieved_and_relocked_at_later_position()
        {
            var data = _cache.TryGetAndLockPartitionState(
                "partition1", CheckpointTag.FromPosition(0, 25000, 24000));

            Assert.AreEqual("data1", data.State);
        }
        public void partitions_locked_before_the_unlock_position_can_be_retrieved_and_relocked_at_later_position()
        {
            var data = _cache.TryGetAndLockPartitionState(
                "partition1", CheckpointTag.FromPosition(0, 1600, 1500));

            Assert.AreEqual("data1", data.State);
        }
 public void given()
 {
     //given
     _cache = new PartitionStateCache(CheckpointTag.FromPosition(0, -1));
     _cachedAtCheckpointTag = CheckpointTag.FromPosition(1000, 900);
     _cache.CacheAndLockPartitionState("partition", new PartitionState("data", null, _cachedAtCheckpointTag), _cachedAtCheckpointTag);
     _relockedData = _cache.TryGetAndLockPartitionState("partition", CheckpointTag.FromPosition(2000, 1900));
 }
 public void cannot_be_relocked_at_the_previous_position()
 {
     _cache.TryGetAndLockPartitionState("partition", _cachedAtCheckpointTag);
 }
 public void thorws_invalid_operation_exception_if_not_allowed()
 {
     _cache.TryGetAndLockPartitionState("partition", CheckpointTag.FromPosition(1000, 900));
 }
Example #7
0
        public void the_state_can_be_retrieved_as_unlocked_and_relocked_at_later_position()
        {
            var state = _cache.TryGetAndLockPartitionState("partition", CheckpointTag.FromPosition(1500, 1400));

            Assert.AreEqual("data", state);
        }
Example #8
0
 public void thorws_invalid_operation_exception()
 {
     _cache.TryGetAndLockPartitionState("partition", CheckpointTag.FromPosition(500, 400));
 }
Example #9
0
 public void thorws_invalid_operation_exception()
 {
     Assert.Throws <InvalidOperationException>(() => { _cache.TryGetAndLockPartitionState("partition", CheckpointTag.FromPosition(0, 500, 400)); });
 }
 public void cannot_be_relocked_at_the_previous_position()
 {
     Assert.Throws <InvalidOperationException>(() => { _cache.TryGetAndLockPartitionState("partition", _cachedAtCheckpointTag); });
 }