Adds Encryption/Decryption string extension methods that work in medium trust, with unit tests.

This commit is contained in:
Shannon Deminick
2013-01-15 01:35:10 +03:00
parent 0045ec353f
commit 5458c9a310
2 changed files with 33 additions and 0 deletions

View File

@@ -10,6 +10,16 @@ namespace Umbraco.Tests
[TestFixture]
public class StringExtensionsTests
{
[TestCase("This is a string to encrypt")]
public void Encrypt_And_Decrypt(string input)
{
var encrypted = input.EncryptWithMachineKey();
var decrypted = encrypted.DecryptWithMachineKey();
Assert.AreNotEqual(input, encrypted);
Assert.AreEqual(input, decrypted);
}
[TestCase("Hello this is my string", " string", "Hello this is my")]
[TestCase("Hello this is my string strung", " string", "Hello this is my string strung")]
[TestCase("Hello this is my string string", " string", "Hello this is my")]