-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
50 additions
and
43 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,33 @@ | ||
namespace Seedysoft.CryptoLib.Tests; | ||
|
||
public sealed class CryptoTests(CryptoTestsFixture cipherFixture) | ||
: IClassFixture<CryptoTestsFixture> | ||
{ | ||
public CryptoTestsFixture CipherFixture { get; } = cipherFixture; | ||
|
||
[Fact] | ||
public void EncryptThenDecryptTest() | ||
{ | ||
string encryptedBytes = Crypto.EncryptText(CipherFixture.TextToEncrypt, CipherFixture.Key); | ||
System.Diagnostics.Debug.WriteLine(encryptedBytes); | ||
|
||
string decryptedText = Crypto.DecryptText(encryptedBytes, CipherFixture.Key); | ||
System.Diagnostics.Debug.WriteLine(decryptedText); | ||
|
||
Assert.Equal(CipherFixture.TextToEncrypt, decryptedText); | ||
} | ||
} | ||
|
||
public sealed class CryptoTestsFixture | ||
{ | ||
public string TextToEncrypt { get; } | ||
public string Key { get; } | ||
|
||
public CryptoTestsFixture() | ||
{ | ||
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; | ||
|
||
TextToEncrypt = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam nulla tellus, elementum sit amet nunc."; | ||
Key = System.Security.Cryptography.RandomNumberGenerator.GetString(chars, 32); | ||
} | ||
} |
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
35 changes: 0 additions & 35 deletions
35
test/CommonLibs/UtilsLib.Tests/Helpers/CryptoHelperTests.cs
This file was deleted.
Oops, something went wrong.
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