public void WhenEncodingTypeBase32_ThenEncodeToBase32() { var obj = TestHasAttributes.Create(); _sut.EncryptProperties(obj, EncodingType.Base32); Assert.That(obj.Name.IsBase32(), Is.True); Assert.That(obj.Address.IsBase32(), Is.True); }
public void WhenAnyEncryptPropertiesSet_ThenReturnTrue() { var sut = TestHasAttributes.Create(); sut.Name = null; var result = sut.IsSensitive(); Assert.That(result, Is.True); }
public void WhenStringPropertyWithAttributeIsNullOrEmpty_ThenDontEncrypt(string value) { var obj = TestHasAttributes.Create(); obj.Name = value; _sut.EncryptProperties(obj); Assert.That(obj.Name, Is.EqualTo(value)); }
public void WhenEncryptPropertiesAreNullOrEmpty_ThenReturnFalse() { var sut = TestHasAttributes.Create(); sut.Name = null; sut.Address = string.Empty; var result = sut.IsSensitive(); Assert.That(result, Is.False); }
public void WhenTypeHasAttributes_ThenEncryptStringPropertiesWithAttribute() { var obj = TestHasAttributes.Create(); _sut.EncryptProperties(obj); Assert.That(obj.Name, Is.Not.EqualTo("John")); Assert.That(obj.Address, Is.Not.EqualTo("Somewhere")); Assert.That(obj.Country, Is.EqualTo("UK")); Assert.That(obj.Age, Is.EqualTo(50)); }
public void WhenEncodingIsHex_ThenDecryptStringPropertiesWithAttribute() { var obj = TestHasAttributes.Create(); _sut.EncryptProperties(obj, EncodingType.Base32); _sut.DecryptProperties(obj, EncodingType.Base32); Assert.That(obj.Name, Is.EqualTo("John")); Assert.That(obj.Address, Is.EqualTo("Somewhere")); Assert.That(obj.Country, Is.EqualTo("UK")); Assert.That(obj.Age, Is.EqualTo(50)); }