public async Task WriteCache_WritesInL1L2_TestAsync(bool enableAsyncL2Write)
        {
            // Arrange
            _provider.GetService <IOptions <MsalDistributedTokenCacheAdapterOptions> >().Value.EnableAsyncL2Write = enableAsyncL2Write;
            byte[] cache = new byte[3];
            AssertCacheValues(_testCacheAdapter);
            Assert.Equal(0, _testCacheAdapter._memoryCache.Count);
            Assert.Empty(L2Cache._dict);

            // Act
            TestDistributedCache.ResetEvent.Reset();
            await _testCacheAdapter.TestWriteCacheBytesAsync(DefaultCacheKey, cache).ConfigureAwait(false);

            // Assert
            Assert.Equal(1, _testCacheAdapter._memoryCache.Count);
            TestDistributedCache.ResetEvent.Wait();
            Assert.Single(L2Cache._dict);
        }
Exemplo n.º 2
0
        public async Task WriteCache_WritesInL1L2_TestAsync()
        {
            // Arrange
            byte[] cache = new byte[3];
            AssertCacheValues(_testCacheAdapter);
            Assert.Equal(0, _testCacheAdapter._memoryCache.Count);
            Assert.Empty(L2Cache.dict);

            // Act
            await _testCacheAdapter.TestWriteCacheBytesAsync(_defaultCacheKey, cache).ConfigureAwait(false);

            // Assert
            Assert.Equal(1, _testCacheAdapter._memoryCache.Count);
            Assert.Single(L2Cache.dict);
        }