public void WhenSecureStringIsNull_RemainsNull() { this.hkcu.DeleteSubKeyTree(TestKeyPath, false); var registryKey = hkcu.CreateSubKey(TestKeyPath); var original = new KeyWithSecureString() { }; new RegistryBinder <KeyWithSecureString>().Store(original, registryKey); var copy = new RegistryBinder <KeyWithSecureString>().Load(registryKey); Assert.IsNull(copy.Secure); }
public void WhenSecureStringIsNull_RemainsNull() { this.hkcu.DeleteSubKeyTree(TestKeyPath, false); var registryKey = hkcu.CreateSubKey(TestKeyPath); var original = new KeyWithSecureString() { }; new RegistryKeyMapper <KeyWithSecureString>().MapObjectToKey(original, registryKey); var copy = new RegistryKeyMapper <KeyWithSecureString>().MapKeyToObject(registryKey); Assert.IsNull(copy.Secure); }
public void WhenSecureStringStored_StringCanBeDecrypted() { this.hkcu.DeleteSubKeyTree(TestKeyPath, false); var registryKey = hkcu.CreateSubKey(TestKeyPath); var original = new KeyWithSecureString() { Secure = SecureStringExtensions.FromClearText("secure!!!") }; new RegistryBinder <KeyWithSecureString>().Store(original, registryKey); var copy = new RegistryBinder <KeyWithSecureString>().Load(registryKey); Assert.AreEqual( "secure!!!", copy.Secure.AsClearText()); }