Пример #1
0
        public async Task Then_The_Item_Is_Removed_From_The_Cache(
            string keyName,
            [Frozen] Mock <IDistributedCache> distributedCache,
            CacheStorageService service)
        {
            //Act
            await service.DeleteFromCache(keyName);

            //Assert
            distributedCache.Verify(x => x.RemoveAsync(keyName, It.IsAny <CancellationToken>()), Times.Once);
        }
        public async Task Then_The_Item_Is_Removed_From_The_Cache(
            string keyName,
            string appName,
            [Frozen] Mock <IDistributedCache> distributedCache,
            [Frozen] Mock <IConfiguration> configuration,
            CacheStorageService service)
        {
            //Arrange
            configuration.SetupGet(x => x[It.Is <string>(s => s.Equals("ConfigNames"))]).Returns(appName);

            //Act
            await service.DeleteFromCache(keyName);

            //Assert
            distributedCache.Verify(x => x.RemoveAsync($"{appName}_{keyName}", It.IsAny <CancellationToken>()), Times.Once);
        }