async Task CanConstructStoragePassword() { var feed = await TestAtomFeed.ReadFeed(Path.Combine(TestAtomFeed.Directory, "StoragePassword.GetAsync.xml")); using (var context = new Context(Scheme.Https, "localhost", 8089)) { var password = new StoragePassword(context, feed); CheckStoragePassword(feed.Entries[0], password); } }
void CheckEai(StoragePassword password) { Assert.DoesNotThrow(() => { bool canList = password.Eai.Acl.CanList; string app = password.Eai.Acl.App; dynamic eai = password.Eai; Assert.Equal(app, eai.Acl.App); Assert.Equal(canList, eai.Acl.CanList); }); }
void CheckStoragePassword(AtomEntry entry, StoragePassword password) { CheckCommonProperties(entry.Title, password); CheckEai(password); Assert.Equal(entry.Content["ClearPassword"], password.ClearPassword); Assert.Equal(entry.Content["EncrPassword"], password.EncryptedPassword); Assert.Equal(entry.Content["Password"], password.Password); Assert.Equal(entry.Content["Username"], password.Username); var dictionary = (IDictionary <string, object>)entry.Content; Assert.Equal(dictionary["Realm"], password.Realm); }
void CheckStoragePassword(AtomEntry entry, StoragePassword password) { CheckCommonProperties(entry.Title, password); CheckEai(password); Assert.Equal(entry.Content.ClearPassword, password.ClearPassword); Assert.Equal(entry.Content.EncrPassword, password.EncryptedPassword); Assert.Equal(entry.Content.Password, password.Password); Assert.Equal(entry.Content.Username, password.Username); //// ExpandoObject hides null values so... var dictionary = (IDictionary <string, object>)entry.Content; Assert.Equal(dictionary["Realm"], password.Realm); }
/// <summary> /// Asynchronously updates a storage password. /// </summary> /// <param name="name"> /// Username identifying the storage password to be updated. /// </param> /// <returns> /// An object representing the updated storage password. /// </returns> /// <remarks> /// This method uses the <a href="http://goo.gl/HL3c0T">POST /// storage/passwords/{name}</a> endpoint to update the storage /// password identified by <see cref="name"/>. /// </remarks> public async Task<StoragePassword> UpdateStoragePasswordAsync(string name, string password) { var resource = new StoragePassword(this.Context, this.Namespace, name); await resource.UpdateAsync(password); return resource; }
/// <summary> /// Asynchronously removes a storage password. /// </summary> /// <param name="name"> /// Username identifying the storage password to be removed. /// </param> /// <returns> /// </returns> /// <remarks> /// This method uses the <a href="http://goo.gl/JGm0JP">DELETE /// storage/passwords/{name}</a> endpoint to remove the <see cref= /// storage password identified by <see cref="name"/>. /// </remarks> public async Task RemoveStoragePasswordAsync(string name) { var resource = new StoragePassword(this.Context, this.Namespace, name); await resource.RemoveAsync(); }
/// <summary> /// Asynchronously retrieves a storage password. /// </summary> /// <param name="name"> /// Username identifying the storage password to be retrieved. /// </param> /// <returns> /// An object representing the storage password retrieved. /// </returns> /// <remarks> /// This method uses the <a href="http://goo.gl/HL3c0T">GET /// storage/passwords/{name}</a> endpoint to construct the <see cref= /// "StoragePassword"/> it returns. /// </remarks> public async Task<StoragePassword> GetStoragePasswordAsync(string name) { var resource = new StoragePassword(this.Context, this.Namespace, name); await resource.GetAsync(); return resource; }
/// <summary> /// Asynchronously creates a new storage password. /// </summary> /// <returns> /// An object representing the storage password created. /// </returns> /// <remarks> /// This method uses the <a href="http://goo.gl/JgyIeN">POST /// storage/passwords</a> endpoint to construct the <see cref= /// "StoragePassword"/> it returns. /// </remarks> public async Task<StoragePassword> CreateStoragePasswordAsync(string name, string password, string realm = null) { var resource = new StoragePassword(this.Context, this.Namespace, name, realm); await resource.CreateAsync(password); return resource; }