Skip to content

Commit

Permalink
Fix unit test 2
Browse files Browse the repository at this point in the history
  • Loading branch information
maythamfahmi committed Dec 23, 2021
1 parent 7e0dbb8 commit f6b486a
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions CryptoNetUnitTests/CryptoNetTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,19 @@ public void Encrypt_Decrypt_Content_With_Wrong_SymmetricKey_Test()
var encrypt = encryptClient.EncryptFromString(ConfidentialDummyData);

// act
const string SymmetricWrongKey = "wrong-secret-key";
ICryptoNet decryptClient = new CryptoNet(SymmetricWrongKey);
var decrypt = decryptClient.DecryptToString(encrypt);

// assert
CheckContent(ConfidentialDummyData, decrypt).ShouldBeFalse();
decrypt.ShouldBe("The parameter is incorrect.");
const string symmetricWrongKey = "wrong-secret-key";
string decrypt = string.Empty;
try
{
ICryptoNet decryptClient = new CryptoNet(symmetricWrongKey);
decrypt = decryptClient.DecryptToString(encrypt);
}
catch (Exception e)
{
// assert
CheckContent(ConfidentialDummyData, decrypt).ShouldBeFalse();
e.Message.ShouldContain("The parameter is incorrect.");
}
}

[TestCase(""), Order(3)]
Expand Down

0 comments on commit f6b486a

Please sign in to comment.