@@ -25,8 +25,11 @@ public void GenerateHexStringTest()
2525 byte [ ] salt = EncryptionManager . CreateRandomSalt ( saltSize ) ;
2626 string hex = EncryptionManager . GetHexStringFromSalt ( salt ) ;
2727
28- Assert . That ( ! string . IsNullOrEmpty ( hex ) ) ;
29- Assert . That ( hex . Length , Is . EqualTo ( saltSize * 2 ) ) ;
28+ using ( Assert . EnterMultipleScope ( ) )
29+ {
30+ Assert . That ( ! string . IsNullOrEmpty ( hex ) ) ;
31+ Assert . That ( hex , Has . Length . EqualTo ( saltSize * 2 ) ) ;
32+ }
3033 }
3134 catch ( Exception ex )
3235 {
@@ -49,27 +52,27 @@ public void EncryptionTests()
4952 Assert . That ( ! string . IsNullOrEmpty ( encryptedWithKey ) ) ;
5053
5154 string decrytpedTextWithKey = EncryptionManager . DecryptStringFromBase64String ( encryptedWithKey , base64Key , 256 ) ;
52- Assert . That ( plainText == decrytpedTextWithKey ) ;
55+ Assert . That ( plainText , Is . EqualTo ( decrytpedTextWithKey ) ) ;
5356
5457 int saltSize = 16 ;
5558 string saltHexString = EncryptionManager . GetHexStringFromSalt ( EncryptionManager . CreateRandomSalt ( saltSize ) ) ;
56- Assert . That ( saltHexString . Length == saltSize * 2 ) ;
59+ Assert . That ( saltHexString , Has . Length . EqualTo ( saltSize * 2 ) ) ;
5760 byte [ ] salt = EncryptionManager . GetSaltFromHexString ( saltHexString ) ;
5861
5962 string userpassword = "This is a secret text" ;
6063 byte [ ] hashedPassword = EncryptionManager . SaltWithPasswordString ( userpassword , salt , 32 ) ;
61- Assert . That ( hashedPassword . Length , Is . EqualTo ( 32 ) ) ;
64+ Assert . That ( hashedPassword , Has . Length . EqualTo ( 32 ) ) ;
6265
6366 string encryptedText = EncryptionManager . EncryptStringToBase64String ( plainText , hashedPassword , 256 ) ;
6467
6568 string decrytpedText = EncryptionManager . DecryptStringFromBase64String ( encryptedText , hashedPassword , 256 ) ;
66- Assert . That ( plainText == decrytpedText ) ;
69+ Assert . That ( plainText , Is . EqualTo ( decrytpedText ) ) ;
6770
6871 // Recreate hash from user password
6972 salt = EncryptionManager . GetSaltFromHexString ( saltHexString ) ;
7073 hashedPassword = EncryptionManager . SaltWithPasswordString ( userpassword , salt , 32 ) ;
7174 decrytpedText = EncryptionManager . DecryptStringFromBase64String ( encryptedText , hashedPassword , 256 ) ;
72- Assert . That ( plainText == decrytpedText ) ;
75+ Assert . That ( plainText , Is . EqualTo ( decrytpedText ) ) ;
7376 }
7477 catch ( Exception ex )
7578 {
@@ -93,12 +96,12 @@ public void UsePasswordDoubleEncryptionTest()
9396 string encryptedPassphrase = EncryptionManager . EncryptStringToBase64String ( passphrase , hashedPassword ) ;
9497
9598 string decryptedPassphrase = EncryptionManager . DecryptStringFromBase64String ( encryptedPassphrase , hashedPassword ) ;
96- Assert . That ( passphrase == decryptedPassphrase ) ;
99+ Assert . That ( passphrase , Is . EqualTo ( decryptedPassphrase ) ) ;
97100
98101 var t = EncryptionManager . EncryptStringToBase64String ( plainText , decryptedPassphrase ) ;
99102 var t2 = EncryptionManager . DecryptStringFromBase64String ( t , decryptedPassphrase ) ;
100103
101- Assert . That ( plainText == t2 ) ;
104+ Assert . That ( plainText , Is . EqualTo ( t2 ) ) ;
102105 }
103106 catch ( Exception ex )
104107 {
0 commit comments