public void MarkDuplicateAsDuplicate() { var distributedCache = new MemoryDistributedCache(Options.Create(new MemoryDistributedCacheOptions())); var duplicateChecker = new DistributedCacheDuplicateChecker(distributedCache, TimeSpan.FromMinutes(10)); duplicateChecker.IsDuplicate(12345); var isDuplicate = duplicateChecker.IsDuplicate(12345); Assert.True(isDuplicate); }
public void NotMarkDuplicateAsDuplicateAfterExpiration() { var distributedCache = new MemoryDistributedCache(Options.Create(new MemoryDistributedCacheOptions())); var duplicateChecker = new DistributedCacheDuplicateChecker(distributedCache, TimeSpan.FromMilliseconds(10)); duplicateChecker.IsDuplicate(12345); Thread.Sleep(11); var isDuplicate = duplicateChecker.IsDuplicate(12345); Assert.False(isDuplicate); }
public void NotMarkNewAsDuplicate() { var distributedCache = new MemoryDistributedCache(Options.Create(new MemoryDistributedCacheOptions())); var duplicateChecker = new DistributedCacheDuplicateChecker(distributedCache, TimeSpan.FromMinutes(10)); duplicateChecker.IsDuplicate(1); duplicateChecker.IsDuplicate(2); duplicateChecker.IsDuplicate(3); duplicateChecker.IsDuplicate(4); var isDuplicate = duplicateChecker.IsDuplicate(5); Assert.False(isDuplicate); }