public void DecryptedActionEncryptsAfterExecution() { // Arrange var data = new TwitterAccountData { OAuthToken = DpApi.Encrypt("token"), OAuthTokenSecret = DpApi.Encrypt("secret") }; // Act data.ExecuteDecryptedAction(d => { }); // Assert Assert.AreNotEqual("token", data.OAuthToken); Assert.AreNotEqual("secret", data.OAuthTokenSecret); }
public void EncryptedFuncPassesThroughReturnValue() { // Arrange var data = new TwitterAccountData { OAuthToken = DpApi.Encrypt("token"), OAuthTokenSecret = DpApi.Encrypt("secret") }; Func <TwitterAccountData, int> action = d => 42; // Act var value = data.ExecuteDecryptedAction(action); // Assert Assert.AreEqual(42, value); }
public void EncryptedActionDecryptsBeforeExecution() { // Arrange var data = new TwitterAccountData { OAuthToken = DpApi.Encrypt("token"), OAuthTokenSecret = DpApi.Encrypt("secret") }; string decryptedToken = ""; string decryptedSecret = ""; Action <TwitterAccountData> action = d => { decryptedToken = d.OAuthToken; decryptedSecret = d.OAuthTokenSecret; }; // Act data.ExecuteDecryptedAction(action); // Assert Assert.AreEqual("token", decryptedToken); Assert.AreEqual("secret", decryptedSecret); }