From 64ab29dbc92afd722904c942449b1d58f7a13857 Mon Sep 17 00:00:00 2001 From: Jean-Marc Prieur Date: Mon, 16 Dec 2024 15:27:54 -0800 Subject: [PATCH] Fix test failing du to change in reference of Microsoft.Extensions.Cache.Memory to 6.x (because of obsolete version 5,x) --- tests/Microsoft.Identity.Web.Test/CacheEncryptionTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Microsoft.Identity.Web.Test/CacheEncryptionTests.cs b/tests/Microsoft.Identity.Web.Test/CacheEncryptionTests.cs index a84157783..4a5ce8b75 100644 --- a/tests/Microsoft.Identity.Web.Test/CacheEncryptionTests.cs +++ b/tests/Microsoft.Identity.Web.Test/CacheEncryptionTests.cs @@ -51,7 +51,7 @@ public async Task EncryptionTestAsync(bool isEncrypted) private byte[] GetFirstCacheValue(MemoryCache memoryCache) { IDictionary memoryCacheContent; -# if NET6_0 +# if NET6_0 || NET462 memoryCacheContent = (memoryCache .GetType() .GetProperty("StringKeyEntriesCollection", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)! @@ -88,7 +88,7 @@ private byte[] GetFirstCacheValue(MemoryCache memoryCache) .GetType() .GetField("_entries", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)! .GetValue(_testCacheAdapter!._memoryCache) as IDictionary)!; -#endif +#endif // NET472 var firstEntry = memoryCacheContent.Values.OfType().First(); var firstEntryValue = firstEntry.GetType() .GetProperty("Value")!