public UpdateDescription ( string description, string apiClientId = null ) : Task |
||
description | string | New API client's description to set. |
apiClientId | string | API client id. If not specified, will update current API client. |
return | Task |
public async Task Update_WithNullDescription_ThrowsException(ApiKeySyncanoClient client) { try { //when await client.UpdateDescription(null); throw new Exception("UpdateDescription should throw an exception"); } catch (Exception e) { //then e.ShouldBeType<ArgumentNullException>(); } }
public async Task Update_WithInvalidApiKeyId_ThrowsException(ApiKeySyncanoClient client) { try { //when await client.UpdateDescription("description", "abcde123"); throw new Exception("UpdateDescription should throw an exception"); } catch (Exception e) { //then e.ShouldBeType<SyncanoException>(); } }
public async Task Update_UpdatesApiKey(ApiKeySyncanoClient client) { //given var description = "apiKey description"; var newDescription = "new apiKey description"; var apiKey = await client.New(description, ApiKeyType.Backend, TestData.RoleId); //when apiKey = await client.UpdateDescription(newDescription, apiKey.Id); //then apiKey.ShouldNotBeNull(); apiKey.Description.ShouldEqual(newDescription); //cleanup await client.Delete(apiKey.Id); }