Class CacheServiceTest
[TestFixture]
public class CacheServiceTest
- Inheritance
-
CacheServiceTest
- Inherited Members
- Extension Methods
Methods
CleanCache_RemovesAllKeys_AndFactoryIsInvokedAfterClean()
Verifies that CleanCache removes all entries from the cache, causing subsequent
GetOrSetObjectAsync calls to invoke the provided factory delegate to repopulate the value.
[Test]
public Task CleanCache_RemovesAllKeys_AndFactoryIsInvokedAfterClean()
Returns
DeleteByPatternAsync_RemovesMatchingKeys_AndKeepsNonMatchingKeys()
Verifies that DeleteByPatternAsync removes only the cache entries whose keys match the supplied pattern while preserving unrelated keys that do not match.
[Test]
public Task DeleteByPatternAsync_RemovesMatchingKeys_AndKeepsNonMatchingKeys()
Returns
DeleteObjectAsync_RemovesKey_AndFactoryIsInvokedOnNextCall()
Verifies that calling DeleteObjectAsync removes the stored value for the given key, and that the next call to GetOrSetObjectAsync invokes the factory delegate to produce a new value instead of returning a previously cached one.
[Test]
public Task DeleteObjectAsync_RemovesKey_AndFactoryIsInvokedOnNextCall()
Returns
GetOrSetObjectAsync_DoesNotCacheNullResult_AndInvokesFactoryOnSubsequentCalls()
Verifies that GetOrSetObjectAsync does not cache null results, ensuring the factory delegate is re-invoked on subsequent calls for the same key when the previously produced value was null.
[Test]
public Task GetOrSetObjectAsync_DoesNotCacheNullResult_AndInvokesFactoryOnSubsequentCalls()
Returns
GetOrSetObjectAsync_InvokesFactory_StoresResult_AndDoesNotInvokeAgainOnSecondCall()
Verifies that GetOrSetObjectAsync invokes the supplied factory on the first call, persists the produced value, and on subsequent calls returns the cached value without invoking the factory again.
[Test]
public Task GetOrSetObjectAsync_InvokesFactory_StoresResult_AndDoesNotInvokeAgainOnSecondCall()
Returns
GetOrSetObjectAsync_ReturnsCachedValue_AndDoesNotInvokeFactory_WhenKeyAlreadyExists()
[Test]
public Task GetOrSetObjectAsync_ReturnsCachedValue_AndDoesNotInvokeFactory_WhenKeyAlreadyExists()
Returns
GetOrSetObjectAsync_SecondCheckInLock_PreventsFactoryExecution_WhenValueAlreadyInsertedByFirstThread()
Verifies that when two threads call GetOrSetObjectAsync concurrently for the same key,
the second thread does not invoke its factory if the first thread has already inserted the value,
and both threads receive the value produced by the first thread's factory.
[Test]
public Task GetOrSetObjectAsync_SecondCheckInLock_PreventsFactoryExecution_WhenValueAlreadyInsertedByFirstThread()
Returns
SetUp()
Initializes the test environment by creating a LockManagerService with a mock logger and an in-memory lock provider, and instantiating the CacheService under test with that lock manager.
[SetUp]
public void SetUp()