Skip to content

Commit b956846

Browse files
committed
Isolate unit tests more definitively
(test improvement only; no production-side changes)
1 parent d7191ed commit b956846

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Polly.Caching.MemoryCache.SharedSpecs/MemoryCacheProviderSpecs.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public void Get_should_return_instance_previously_stored_in_cache()
5353
MemoryCacheImplementation memoryCache = System.Runtime.Caching.MemoryCache.Default;
5454
#endif
5555

56-
string key = "anything";
56+
string key = Guid.NewGuid().ToString();
5757
object value = new object();
5858
#if PORTABLE
5959
using (Microsoft.Extensions.Caching.Memory.ICacheEntry entry = memoryCache.CreateEntry(key)) {
@@ -96,7 +96,7 @@ public void Put_should_put_item_into_configured_MemoryCacheImplementation()
9696
MemoryCacheImplementation memoryCache = System.Runtime.Caching.MemoryCache.Default;
9797
#endif
9898

99-
string key = "anything";
99+
string key = Guid.NewGuid().ToString();
100100
object value = new object();
101101

102102
MemoryCacheProvider provider = new MemoryCacheProvider(memoryCache);
@@ -124,7 +124,7 @@ public void Put_should_put_item_using_passed_nonsliding_ttl()
124124

125125
TimeSpan shimTimeSpan = TimeSpan.FromSeconds(0.1); // If test fails transiently in different environments, consider increasing shimTimeSpan.
126126

127-
string key = "anything";
127+
string key = Guid.NewGuid().ToString();
128128
object value = new object();
129129

130130
MemoryCacheProvider provider = new MemoryCacheProvider(memoryCache);
@@ -164,7 +164,7 @@ public void Put_should_put_item_using_passed_sliding_ttl()
164164

165165
TimeSpan shimTimeSpan = TimeSpan.FromSeconds(1); // If test fails transiently in different environments, consider increasing shimTimeSpan.
166166

167-
string key = "anything";
167+
string key = Guid.NewGuid().ToString();
168168
object value = new object();
169169

170170
// Place an item in the cache that should last for only 2x shimTimespan

0 commit comments

Comments
 (0)