public void TestMyObjectEncryption() { PubnubCrypto pc = new PubnubCrypto("enigma"); //create an object of the custom class CustomClass cc = new CustomClass(); //serialize it JavaScriptSerializer js = new JavaScriptSerializer(); string res = js.Serialize(cc); //encrypt it string enc = pc.EncryptOrDecrypt(true, res); Assert.AreEqual("Zbr7pEF/GFGKj1rOstp0tWzA4nwJXEfj+ezLtAr8qqE=", enc); }
public void TestMyObjectDecryption() { PubnubCrypto pc = new PubnubCrypto("enigma"); //Deserialized string strMessage= "Zbr7pEF/GFGKj1rOstp0tWzA4nwJXEfj+ezLtAr8qqE="; //Decrypt string dec = pc.EncryptOrDecrypt(false, strMessage); //create an object of the custom class CustomClass cc = new CustomClass(); JavaScriptSerializer js = new JavaScriptSerializer(); //Serialize it string res = js.Serialize(cc); Assert.AreEqual(res, dec); }