Пример #1
0
        public void EncryptPassword_Should_Generate_The_Same_HashPassword_For_Given_Salt_And_Password()
        {
            // Arrange
            const string PASSWORD       = "******";
            var          encryptService = new EncryptService();
            var          salt           = encryptService.GeneratePasswordSalt();

            // Act
            var passwordData1 = encryptService.EncryptPassword(PASSWORD, salt);
            var passwordData2 = encryptService.EncryptPassword(PASSWORD, salt);

            // Assert
            Assert.AreEqual(passwordData1.Password, passwordData2.Password);
            Assert.AreEqual(passwordData1.PasswordSalt, passwordData2.PasswordSalt);
            Assert.AreEqual(passwordData1.PasswordHash, passwordData2.PasswordHash);
        }
Пример #2
0
        public void EncryptPassword_Should_Generate_Password_And_Salt()
        {
            // Arrange
            const string PASSWORD       = "******";
            var          encryptService = new EncryptService();

            // Act
            var passwordData = encryptService.EncryptPassword(PASSWORD);

            // Assert
            Assert.AreEqual(PASSWORD, passwordData.Password);
            Assert.AreEqual(32, passwordData.PasswordSalt.Length);
            Assert.AreEqual(32, passwordData.PasswordHash.Length);
        }