U:调整所有代码格式
This commit is contained in:
1 parent
d133bacf55
commit
155b67e831
342 files changed
+9431
-9868
No files matched your search
@@ -67,10 +67,7 @@ public class CryptoHelperTests
|
||||
var encrypted = CryptoHelper.AesEncrypt(plainText, correctPassword);
|
||||
|
||||
// Act & Assert
|
||||
Assert.ThrowsException<CryptographicException>(() =>
|
||||
{
|
||||
CryptoHelper.AesDecrypt(encrypted, wrongPassword);
|
||||
});
|
||||
Assert.ThrowsException<CryptographicException>(() => { CryptoHelper.AesDecrypt(encrypted, wrongPassword); });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -79,10 +76,7 @@ public class CryptoHelperTests
|
||||
[TestMethod]
|
||||
public void AesEncrypt_EmptyString_ThrowsException()
|
||||
{
|
||||
Assert.ThrowsException<ArgumentNullException>(() =>
|
||||
{
|
||||
CryptoHelper.AesEncrypt("", "password");
|
||||
});
|
||||
Assert.ThrowsException<ArgumentNullException>(() => { CryptoHelper.AesEncrypt("", "password"); });
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -155,10 +149,7 @@ public class CryptoHelperTests
|
||||
var encrypted = CryptoHelper.RsaEncrypt(plainText, publicKey1);
|
||||
|
||||
// Act & Assert
|
||||
Assert.ThrowsException<CryptographicException>(() =>
|
||||
{
|
||||
CryptoHelper.RsaDecrypt(encrypted, privateKey2);
|
||||
});
|
||||
Assert.ThrowsException<CryptographicException>(() => { CryptoHelper.RsaDecrypt(encrypted, privateKey2); });
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -396,7 +387,7 @@ public class CryptoHelperTests
|
||||
var password = "test";
|
||||
|
||||
// Act
|
||||
var hash = CryptoHelper.HashPassword(password, saltSize: 32, iterations: 50000, hashSize: 64);
|
||||
var hash = CryptoHelper.HashPassword(password, 32, 50000, 64);
|
||||
var isValid = CryptoHelper.VerifyPassword(password, hash);
|
||||
|
||||
// Assert
|
||||
@@ -514,7 +505,7 @@ public class CryptoHelperTests
|
||||
// Arrange & Act
|
||||
var str10 = CryptoHelper.GenerateRandomString(10);
|
||||
var str20 = CryptoHelper.GenerateRandomString(20);
|
||||
var strWithSpecial = CryptoHelper.GenerateRandomString(15, useSpecialChars: true);
|
||||
var strWithSpecial = CryptoHelper.GenerateRandomString(15, true);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(10, str10.Length);
|
||||
@@ -548,10 +539,10 @@ public class CryptoHelperTests
|
||||
// Act
|
||||
var password = CryptoHelper.GeneratePassword(
|
||||
12,
|
||||
requireDigit: true,
|
||||
requireLowercase: true,
|
||||
requireUppercase: true,
|
||||
requireSpecialChar: false
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
false
|
||||
);
|
||||
|
||||
// Assert
|
||||
@@ -745,4 +736,4 @@ public class CryptoHelperTests
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user