77using Xtensive . Core ;
88using Xtensive . Orm . Tests ;
99
10+ #pragma warning disable IDE0058
1011
1112namespace Xtensive . Orm . Tests . Core . Caching
1213{
1314 [ TestFixture ]
1415 public class FastConcurrentLruCacheTest
1516 {
1617 private FastConcurrentLruCache < string , TestClass > globalCache ;
17- private Random random = RandomManager . CreateRandom ( ( int ) DateTime . Now . Ticks ) ;
18+ private readonly Random random = RandomManager . CreateRandom ( ( int ) DateTime . Now . Ticks ) ;
1819
19- class BadTestClass :
20- IIdentified < String > ,
20+ private class BadTestClass :
21+ IIdentified < string > ,
2122 IHasSize
2223 {
2324 object IIdentified . Identifier
@@ -54,8 +55,8 @@ public void ConstructorsTest()
5455 cache1 . Add ( item ) ;
5556 Assert . AreEqual ( 1 , cache1 . Count ) ;
5657
57- for ( int i = 0 ; i < 100000 ; i ++ ) {
58- TestClass test = new TestClass ( "" + i ) ;
58+ for ( int i = 0 ; i < 100000 ; i ++ ) {
59+ TestClass test = new TestClass ( "" + i ) ;
5960 cache1 . Add ( test ) ;
6061 }
6162 }
@@ -145,7 +146,7 @@ public void RemoveDenyTest3()
145146 Assert . Throws < ArgumentNullException > ( ( ) => cache . Remove ( test1 ) ) ;
146147 }
147148
148- private static bool canFinish = true ;
149+ private static readonly bool canFinish = true ;
149150
150151 [ Test ]
151152 public void SynchronizationTest ( )
@@ -160,7 +161,7 @@ public void SynchronizationTest()
160161 var removeThreads = new Task [ 10 ] ;
161162 var cancellationTokenSource = new CancellationTokenSource ( ) ;
162163
163- for ( int i = 0 ; i < 10 ; i ++ ) {
164+ for ( int i = 0 ; i < 10 ; i ++ ) {
164165 addThreads [ i ] = new Task ( ( ) => AddItem ( cancellationTokenSource . Token ) , cancellationTokenSource . Token ) ;
165166 removeThreads [ i ] = new Task ( ( ) => RemoveItem ( cancellationTokenSource . Token ) , cancellationTokenSource . Token ) ;
166167 }
@@ -207,7 +208,7 @@ private void RemoveItem(CancellationToken cancellationToken)
207208 test = testClass ;
208209 break ;
209210 }
210- if ( test != null )
211+ if ( test != null )
211212 globalCache . Remove ( test ) ;
212213 }
213214 cancellationToken . ThrowIfCancellationRequested ( ) ;
@@ -232,7 +233,7 @@ private void Increase(int workingThreadsCount, int ioThreadsCount)
232233 ThreadPool . SetMinThreads ( workingThreadsCount , ioThreadsCount ) ;
233234 }
234235
235- private static void Decrease ( bool disposing , Func < int > workingThreadsCountAcccessor , Func < int > ioThreadsCountAcccessor )
236+ private static void Decrease ( Func < int > workingThreadsCountAcccessor , Func < int > ioThreadsCountAcccessor )
236237 {
237238 ThreadPool . SetMinThreads ( workingThreadsCountAcccessor ( ) , ioThreadsCountAcccessor ( ) ) ;
238239 }
@@ -249,7 +250,7 @@ private int Bb()
249250
250251
251252 public ThreadPoolThreadsIncreaser ( int workingThreadsCount , int ioThreadsCount )
252- : base ( ( disposing ) => Decrease ( disposing , A , B ) )
253+ : base ( ( disposing ) => Decrease ( A , B ) )
253254 {
254255 Increase ( workingThreadsCount , ioThreadsCount ) ;
255256 A = Aa ;
0 commit comments