public void EncodeShouldDoIt()
        {
            // Arrange
            const string str = "helloworld";

            // Act
            var password = _encryptor.Encode(str, _parameters);

            // Assert
            _encryptServiceMock.Verify(x => x.Encode(str, It.IsAny <RSAParameters>()), Times.Once);
        }
Esempio n. 2
0
        private Password Handle(string passwordStr, RSAParameters key)
        {
            try
            {
                var password = _passwordEncryptor.Encode(passwordStr, key);

                _logger.Debug("Password model {@password}", password);

                return(password);
            }
            catch (BadLengthException ble)
            {
                const string message = "One of passwords is too long";
                _logger.Error(ble.Message);

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