Пример #1
0
 public void Invoke()
 {
     var value1 = new MethodLevelCachingStub().GetRandomInt();
     Assert.IsTrue(value1 > -1);
     var value2 = new MethodLevelCachingStub().GetRandomInt();
     Assert.AreEqual(value1, value2);
 }
Пример #2
0
 public void Invoke_CacheDisabledInConfig()
 {
     var value1 = new MethodLevelCachingStub().GetRandomIntCacheConfigured();
     Assert.IsTrue(value1 > -1);
     var value2 = new MethodLevelCachingStub().GetRandomIntCacheConfigured();
     Assert.AreNotEqual(value1, value2);
     Assert.IsTrue(value2 > -1);
 }
Пример #3
0
 public void Invoke_CacheExpiryInConfig()
 {
     var value1 = new MethodLevelCachingStub().GetRandomIntCacheExpiresConfigured();
     Assert.IsTrue(value1 > -1);
     var value2 = new MethodLevelCachingStub().GetRandomIntCacheExpiresConfigured();
     Assert.AreEqual(value1, value2);
     Thread.Sleep(200);
     var value3 = new MethodLevelCachingStub().GetRandomIntCacheExpiresConfigured();
     Assert.AreEqual(value1, value3);
     Thread.Sleep(1000);
     var value4 = new MethodLevelCachingStub().GetRandomIntCacheExpiresConfigured();
     Assert.AreNotEqual(value1, value4);
     Assert.IsTrue(value4 > -1);
 }