mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-27 22:56:45 -04:00
Fixed: Extra tests and fixes for new track parser (#632)
* Extra tests and fixes for new track parser * Address review comments, add extra test, fix logging
This commit is contained in:
@@ -107,26 +107,23 @@ namespace NzbDrone.Common.Test.CacheTests
|
||||
public void should_clear_expired_when_they_expire()
|
||||
{
|
||||
int hitCount = 0;
|
||||
_cachedString = new Cached<string>();
|
||||
|
||||
Func<string> testfunc = () => {
|
||||
hitCount++;
|
||||
return null;
|
||||
};
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
_cachedString.Get("key", () =>
|
||||
{
|
||||
hitCount++;
|
||||
return null;
|
||||
}, TimeSpan.FromMilliseconds(300));
|
||||
|
||||
_cachedString.Values.Should().HaveCount(0);
|
||||
|
||||
_cachedString.Get("key", testfunc, TimeSpan.FromMilliseconds(300));
|
||||
|
||||
Thread.Sleep(100);
|
||||
|
||||
_cachedString.Values.Should().HaveCount(1);
|
||||
|
||||
_cachedString.Get("key", testfunc, TimeSpan.FromMilliseconds(300));
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
|
||||
Thread.Sleep(1000);
|
||||
|
||||
hitCount.Should().BeInRange(3, 6);
|
||||
_cachedString.Values.Should().HaveCount(0);
|
||||
hitCount.Should().Be(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user