Skip to content

Commit

Permalink
Fix tests (#3068)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmprieur authored Oct 8, 2024
1 parent cc33716 commit 9d05e13
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tests/Microsoft.Identity.Web.Test/CacheEncryptionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private byte[] GetFirstCacheValue(MemoryCache memoryCache)
.GetType()
.GetField("_entries", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)
.GetValue(content1) as IDictionary)!;
#elif NET8_0_OR_GREATER
#elif NET8_0
dynamic content1 = memoryCache
.GetType()
.GetField("_coherentState", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)!
Expand All @@ -74,6 +74,15 @@ private byte[] GetFirstCacheValue(MemoryCache memoryCache)
.GetType()
.GetField("_stringEntries", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)
.GetValue(content1) as IDictionary)!;
#elif NET9_0_OR_GREATER
dynamic content1 = memoryCache
.GetType()
.GetField("_coherentState", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)!
.GetValue(memoryCache)!;
memoryCacheContent = (content1?
.GetType()
.GetProperty("EntriesCollection", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)
.GetValue(content1) as IDictionary)!;
#else
memoryCacheContent = (memoryCache
.GetType()
Expand Down

0 comments on commit 9d05e13

Please sign in to comment.