public void TestEncryptedParts_Decrypt_Object() { var cipher = GetCipher(); var instance = new object(); var target1 = new EncryptedParts(instance, cipher); target1.Encrypt(); var target2 = new EncryptedParts(instance, cipher); target2.Decrypt(); // should succeed Assert.IsTrue(true); }
public void TestEncryptedParts_Decrypt_Default_ClassTwoPropertiesOneFieldTwoEncrypted() { var cipher = GetCipher(); var instance = new ClassTwoPropertiesOneFieldTwoEncrypted(); var target1 = new EncryptedParts(instance, cipher); target1.Encrypt(); Assert.IsTrue(instance.Encrypted != null); Assert.IsTrue(instance.Encrypted.Length != 0); var target2 = new EncryptedParts(instance, cipher); target2.Decrypt(); Assert.IsNull(instance.Decrypted1); }
public void TestEncryptedParts_Decrypt_ClassTwoPropertiesTwoEncrypted() { var cipher = GetCipher(); var instance = new ClassTwoPropertiesTwoEncrypted { Decrypted1 = "Cooper" }; var target1 = new EncryptedParts(instance, cipher); target1.Encrypt(); Assert.IsTrue(instance.Encrypted != null); Assert.IsTrue(instance.Encrypted.Length != 0); var target2 = new EncryptedParts(instance, cipher); target2.Decrypt(); Assert.AreEqual("Cooper", instance.Decrypted1); }
public void TestEncryptedParts_RoundTrip_ClassOnePropertyOneEncrypted() { var cipher = GetCipher(); var instance = new ClassOnePropertyOneEncrypted { Decrypted1 = "pipi" }; var target1 = new EncryptedParts(instance, cipher); target1.Encrypt(); Assert.IsTrue(instance.Encrypted != null); Assert.IsTrue(instance.Encrypted.Length != 0); var target2 = new EncryptedParts(instance, cipher); target2.Decrypt(); Assert.AreEqual("pipi", instance.Decrypted1); }
public void TestEncryptedParts_Decrypt_ClassTwoPropertiesOneFieldTwoEncrypted() { var cipher = GetCipher(); var instance = new ClassTwoPropertiesOneFieldTwoEncrypted { Decrypted1 = "gogo", }; instance.SetDecrypted3(3); var target1 = new EncryptedParts(instance, cipher); target1.Encrypt(); Assert.IsTrue(instance.Encrypted != null); Assert.IsTrue(instance.Encrypted.Length != 0); var target2 = new EncryptedParts(instance, cipher); target2.Decrypt(); Assert.AreEqual("gogo", instance.Decrypted1); Assert.AreEqual(3, instance.GetDecrypted3()); }