Skip to content

Commit 9d05e13

Browse files
authored
Fix tests (#3068)
1 parent cc33716 commit 9d05e13

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tests/Microsoft.Identity.Web.Test/CacheEncryptionTests.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ private byte[] GetFirstCacheValue(MemoryCache memoryCache)
6565
.GetType()
6666
.GetField("_entries", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)
6767
.GetValue(content1) as IDictionary)!;
68-
#elif NET8_0_OR_GREATER
68+
#elif NET8_0
6969
dynamic content1 = memoryCache
7070
.GetType()
7171
.GetField("_coherentState", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)!
@@ -74,6 +74,15 @@ private byte[] GetFirstCacheValue(MemoryCache memoryCache)
7474
.GetType()
7575
.GetField("_stringEntries", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)
7676
.GetValue(content1) as IDictionary)!;
77+
#elif NET9_0_OR_GREATER
78+
dynamic content1 = memoryCache
79+
.GetType()
80+
.GetField("_coherentState", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)!
81+
.GetValue(memoryCache)!;
82+
memoryCacheContent = (content1?
83+
.GetType()
84+
.GetProperty("EntriesCollection", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)
85+
.GetValue(content1) as IDictionary)!;
7786
#else
7887
memoryCacheContent = (memoryCache
7988
.GetType()

0 commit comments

Comments
 (0)