public void ValueIsNotDisposedBeforeCall() { var disposable = new CustomDisposable(); var valueInfo = new CacheStorageValueInfo <CustomDisposable>(disposable, TimeSpan.FromMilliseconds(250)); Assert.That(disposable.IsDiposed, Is.False); }
public void ReturnsTrueWhenTheValueIsNotReadAndSlidingPolicyIsUsed() { var valueInfo = new CacheStorageValueInfo<int>(0, new SlidingExpirationPolicy(new TimeSpan(0, 0, 2))); ThreadHelper.Sleep(2500); Assert.IsTrue(valueInfo.IsExpired); }
public void ReturnsTrueWhenTimeSpanIsNotZeroAndValueIsExpired() { var valueInfo = new CacheStorageValueInfo <int>(0, new TimeSpan(0, 0, 0, 0, 250)); ThreadHelper.Sleep(500); Assert.IsTrue(valueInfo.IsExpired); }
public void ReturnsTrueWhenTheValueIsNotReadAndSlidingPolicyIsUsed() { var valueInfo = new CacheStorageValueInfo <int>(0, new SlidingExpirationPolicy(new TimeSpan(0, 0, 0, 0, 250))); ThreadHelper.Sleep(500); Assert.IsTrue(valueInfo.IsExpired); }
public void ReturnsTrueWhenTimeSpanIsNotZeroAndValueIsExpired() { var valueInfo = new CacheStorageValueInfo<int>(0, new TimeSpan(0, 0, 0, 0, 250)); ThreadHelper.Sleep(500); Assert.IsTrue(valueInfo.IsExpired); }
public void ValueIsDisposedAfterCall() { var disposable = new CustomDisposable(); var valueInfo = new CacheStorageValueInfo <CustomDisposable>(disposable, TimeSpan.FromMilliseconds(250)); valueInfo.DisposeValue(); Assert.That(disposable.IsDiposed, Is.True); }
public void ReturnsFalseWhileTheValueIsReadAndSlidingPolicyIsUsed() { var valueInfo = new CacheStorageValueInfo<int>(0, new SlidingExpirationPolicy(new TimeSpan(0, 0, 2))); DateTime startTime = DateTime.Now; do { #pragma warning disable 168 int value = valueInfo.Value; #pragma warning restore 168 Assert.IsFalse(valueInfo.IsExpired); } while (DateTime.Now.Subtract(startTime).TotalSeconds < 10); }
public void ReturnsFalseWhileTheValueIsReadAndSlidingPolicyIsUsed() { var valueInfo = new CacheStorageValueInfo <int>(0, new SlidingExpirationPolicy(new TimeSpan(0, 0, 1))); DateTime startTime = DateTime.Now; do { #pragma warning disable 168 int value = valueInfo.Value; #pragma warning restore 168 Assert.IsFalse(valueInfo.IsExpired); }while (DateTime.Now.Subtract(startTime).TotalSeconds < 3); }
public void ReturnsFalseWhenTimeSpanIsNotZeroButValueIsNotExpired() { var valueInfo = new CacheStorageValueInfo<int>(0, new TimeSpan(0, 0, 2)); Assert.IsFalse(valueInfo.IsExpired); }
public void ReturnsTrueWhenTimeSpanIsNotZero() { var valueInfo = new CacheStorageValueInfo<int>(0, new TimeSpan(0, 0, 5)); Assert.IsTrue(valueInfo.CanExpire); }
public void ReturnsFalseWhenTimeSpanIsZero() { var valueInfo = new CacheStorageValueInfo<int>(0, new TimeSpan(0)); Assert.IsFalse(valueInfo.CanExpire); }
public void ReturnsFalseWhenTimeSpanIsNotZeroButValueIsNotExpired() { var valueInfo = new CacheStorageValueInfo <int>(0, new TimeSpan(0, 0, 2)); Assert.IsFalse(valueInfo.IsExpired); }
public void ReturnsTrueWhenTimeSpanIsNotZero() { var valueInfo = new CacheStorageValueInfo <int>(0, new TimeSpan(0, 0, 5)); Assert.IsTrue(valueInfo.CanExpire); }
public void ReturnsFalseWhenTimeSpanIsZero() { var valueInfo = new CacheStorageValueInfo <int>(0, new TimeSpan(0)); Assert.IsFalse(valueInfo.CanExpire); }
public void ValueIsDisposedAfterCall() { var disposable = new CustomDisposable(); var valueInfo = new CacheStorageValueInfo<CustomDisposable>(disposable, TimeSpan.FromMilliseconds(250)); valueInfo.DisposeValue(); Assert.That(disposable.IsDiposed, Is.True); }
public void ValueIsNotDisposedBeforeCall() { var disposable = new CustomDisposable(); var valueInfo = new CacheStorageValueInfo<CustomDisposable>(disposable, TimeSpan.FromMilliseconds(250)); Assert.That(disposable.IsDiposed, Is.False); }