コード例 #1
0
        public void DecodeShouldDoIt()
        {
            // Arrange
            const string str = "helloworld";

            // Act
            _encryptor.Decode(new Password {
                Encoded = str
            }, _parameters);

            // Assert
            _encryptServiceMock.Verify(x => x.Decode(str, It.IsAny <RSAParameters>()), Times.Once);
        }
コード例 #2
0
        private string Handle(Password password, RSAParameters key)
        {
            try
            {
                _logger.Debug("Trying to retrieve password {@password}", password);

                var result = _passwordEncryptor.Decode(password, key);

                return(result);
            }
            catch (Exception e)
            {
                const string message = "Incorrect link";
                _logger.Error(e.Message);

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