public void ConvertFromStringShouldWorkCorrectly()
        {
            // Arrange
            var key = _keyGenerator.GenerateKey();
            var str = _keyGenerator.ToString(key);

            // Act
            var result = _keyGenerator.FromString(str);

            // Assert
            result.ShouldNotBeNull();
        }
        public async Task <string[]> Handle(RetrievePasswordRequest request, CancellationToken cancellationToken)
        {
            _logger.Information("Get group with id {passwordGroupId}", request.PasswordGroupId);

            var redisClient = _redisClientFactory.GetClient();
            var oldCacheKey = new PasswordGroupKey(request.PasswordGroupId);
            var newCacheKey = new PasswordGroupKey(Guid.NewGuid());

            _logger.Information("Renaming key {@oldKey} to {@newKey}", oldCacheKey, newCacheKey);

            try
            {
                await redisClient.RenameAsync(oldCacheKey, newCacheKey);
            }
            catch (RedisServerException rse)
            {
                const string message = "Link not exists";
                _logger.Error(rse.Message);

                throw new HttpResponseException(HttpStatusCode.BadRequest, message);
            }

            var passwordGroup = await redisClient.GetAsync <PasswordGroupKey, PasswordGroup>(newCacheKey);

            await redisClient.DeleteAsync(newCacheKey);

            if (passwordGroup == null)
            {
                const string message = "Link not exists";
                _logger.Error(message);

                throw new HttpResponseException(HttpStatusCode.BadRequest, message);
            }

            var key = _keyGenerator.FromString(request.Key);

            var result = passwordGroup.Passwords
                         .Select(password => Handle(password, key))
                         .ToArray();

            return(result);
        }