public void ChangeFromInternalToExternalMergesPasswords( ) { // Set up XmlPasswordData.From( new SettingsTextResource( _settings ) ) .SavePasswords( new List<PasswordDigestDocument> { TestPasswords.Abcd } ); var passwordsFile = new FileInfo( TempFile ); XmlPasswordData.From( new FileTextResource( passwordsFile ) ) .SavePasswords( new List<PasswordDigestDocument> { TestPasswords.Efgh } ); _settings.PasswordsAreExternal = false; _storageConfiguration = new StorageConfiguration( _settings, _storage ); // Exercise _storageConfiguration.SelectExternalStorage( passwordsFile ); // Verify Assert.That( _storage.PasswordRepository.PasswordData.LoadPasswords( ), Is.EquivalentTo( new[ ] { TestPasswords.Abcd, TestPasswords.Efgh } ) ); }
public void ChangeFromInternalToExternalSavesFurtherPasswordsToExternal( ) { // Set up var passwordsFile = new FileInfo( TempFile ); PasswordDigestDocument password = new PasswordDigestDocumentBuilder { Key = "abc " }; _settings.PasswordsAreExternal = false; _storageConfiguration = new StorageConfiguration( _settings, _storage ); _storageConfiguration.SelectExternalStorage( passwordsFile ); // Exercise _storage.PasswordRepository.SavePassword( password ); // Verify var passwords = XmlPasswordData .From( new FileTextResource( passwordsFile ) ) .LoadPasswords( ); Assert.That( passwords, Is.EquivalentTo( new[ ] { password } ) ); }