File tree Expand file tree Collapse file tree 2 files changed +38
-2
lines changed
src/DotNetToolkit.Repository/Configuration/Caching
test/DotNetToolkit.Repository.Test Expand file tree Collapse file tree 2 files changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -17,14 +17,22 @@ public sealed class CacheProviderManager
1717 /// <summary>
1818 /// Gets the global caching prefix counter.
1919 /// </summary>
20- internal static int GlobalCachingPrefixCounter { get { return _counter ; } }
20+ public static int GlobalCachingPrefixCounter { get { return _counter ; } }
2121
2222 /// <summary>
23- /// Clears the cache .
23+ /// Increments the caching prefix counter .
2424 /// </summary>
2525 public static void IncrementCounter ( )
2626 {
2727 Interlocked . Increment ( ref _counter ) ;
2828 }
29+
30+ /// <summary>
31+ /// Decrements the caching prefix counter.
32+ /// </summary>
33+ public static void DecrementCounter ( )
34+ {
35+ Interlocked . Decrement ( ref _counter ) ;
36+ }
2937 }
3038}
Original file line number Diff line number Diff line change 1+ namespace DotNetToolkit . Repository . Test
2+ {
3+ using Configuration . Caching ;
4+ using Xunit ;
5+
6+ public class CachingProviderManagerTests
7+ {
8+ [ Fact ]
9+ public void IncrementCounter ( )
10+ {
11+ var counter = CacheProviderManager . GlobalCachingPrefixCounter ;
12+
13+ CacheProviderManager . IncrementCounter ( ) ;
14+
15+ Assert . Equal ( counter + 1 , CacheProviderManager . GlobalCachingPrefixCounter ) ;
16+ }
17+
18+ [ Fact ]
19+ public void DecrementCounter ( )
20+ {
21+ var counter = CacheProviderManager . GlobalCachingPrefixCounter ;
22+
23+ CacheProviderManager . DecrementCounter ( ) ;
24+
25+ Assert . Equal ( counter - 1 , CacheProviderManager . GlobalCachingPrefixCounter ) ;
26+ }
27+ }
28+ }
You can’t perform that action at this time.
0 commit comments