Skip to content

Instantly share code, notes, and snippets.

@jkuemerle
Created August 30, 2012 03:53
Show Gist options
  • Select an option

  • Save jkuemerle/3522164 to your computer and use it in GitHub Desktop.

Select an option

Save jkuemerle/3522164 to your computer and use it in GitHub Desktop.
Unit test showing automatically encrypted property
using MbUnit.Framework;
namespace DataAccessTests {
[TestFixture]
public class CredentialTest
{
[Test]
public void TestPasswordIsEncrypted() {
var cr = new DataAccess.DTO.Credential();
cr.Password = "Password1!";
Assert.AreNotEqual("Password1!", cr.Password);
}
[Test]
public void TestPasswordDecryption() {
var cr = new DataAccess.DTO.Credential();
cr.Password = "Password1!";
Assert.AreEqual("Password1!", ((DataAccess.Aspects.IEncrypted)cr).AsClear("Password"));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment