-
-
Notifications
You must be signed in to change notification settings - Fork 308
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #170 from InCerryGit/master
fix potential thread safety issues.
- Loading branch information
Showing
2 changed files
with
31 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System.Threading.Tasks; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace AgileConfig.Server.Common.Tests; | ||
|
||
[TestClass] | ||
public class EncryptTests | ||
{ | ||
private const string Origin = "123456"; | ||
private const string Expected = "E10ADC3949BA59ABBE56E057F20F883E"; | ||
|
||
[TestMethod] | ||
public void Md5Test() | ||
{ | ||
var result = Encrypt.Md5(Origin); | ||
Assert.AreEqual(Expected, result); | ||
} | ||
|
||
[TestMethod] | ||
public void ParallelCallTest() | ||
{ | ||
Parallel.For(0, 1000, _ => | ||
{ | ||
var result = Encrypt.Md5(Origin); | ||
Assert.AreEqual(Expected, result); | ||
}); | ||
} | ||
} |