private static Func <ICache <string, TResource> > GetVersionPartitionedCacheFactory() { var partitionedSharedCache = new VersionPartitionedSharedCache <string, TResource, string>(x => x.Metadata.Name, x => x.Metadata.ResourceVersion); return(() => partitionedSharedCache.CreatePartition()); }
public void AddItem_WhenExistingItemInOtherPartitions_ReuseExistingValue() { var resourceV1 = new TestResource(1, 1); var otherResourceV1 = new TestResource(1, 1); var partition1 = _sut.CreatePartition(); var partition2 = _sut.CreatePartition(); partition1.Add(resourceV1.Key, resourceV1); partition2.Add(resourceV1.Key, otherResourceV1); _sut.Items.Should().HaveCount(1); partition1.Should().HaveCount(1); partition2.Should().HaveCount(1); partition2[1].Should().BeSameAs(resourceV1); }