public Update ( string projectId, string collectionId = null, string collectionKey = null, string name = null, string description = null ) : Task |
||
projectId | string | Project id. |
collectionId | string | Collection id defining a collection. |
collectionKey | string | Collection key defining a collection. |
name | string | New collection name. |
description | string | New collection description. |
return | Task |
public async Task Update_WithNullProjectIdId_ThrowsException(CollectionSyncanoClient client) { try { //when await client.Update(null, TestData.CollectionId); throw new Exception("Update should throw an exception"); } catch (Exception e) { //then e.ShouldBeType<ArgumentNullException>(); } }
public async Task Update_ByCollectionId_WithoutNameAndDescription(CollectionSyncanoClient client) { //given string collectionName = "NewCollection test " + DateTime.Now.ToLongTimeString() + " " + DateTime.Now.ToShortDateString(); string collectionKey = "qwert"; var collection = await client.New(TestData.ProjectId, collectionName, collectionKey); //when collection = await client.Update(TestData.ProjectId, collection.Id); //then collection.ShouldNotBeNull(); collection.Key.ShouldEqual(collectionKey); //cleanup await client.Delete(TestData.ProjectId, collection.Id); }
public async Task Update_WithInvalidProjectIdId_ThrowsException(CollectionSyncanoClient client) { try { //when await client.Update("abcde", TestData.CollectionId); throw new Exception("Update should throw an exception"); } catch (Exception e) { //then e.ShouldBeType<SyncanoException>(); } }
public async Task Update_ByCollectionId_NewCollectionKey(CollectionSyncanoClient client) { //given string collectionName = "NewCollection test " + DateTime.Now.ToLongTimeString() + " " + DateTime.Now.ToShortDateString(); string collectionKey = "qwert"; string collectionDescription = "abcde"; string newCollectionName = "New name " + collectionName; string newKey = "newKey value"; var collection = await client.New(TestData.ProjectId, collectionName, collectionKey); await client.Activate(TestData.ProjectId, collection.Id, true); //when collection = await client.Update(TestData.ProjectId, collection.Id, collectionKey: newKey, name: newCollectionName, description: collectionDescription); //then collection.ShouldNotBeNull(); collection.Key.ShouldEqual(newKey); collection.Name.ShouldEqual(newCollectionName); collection.Description.ShouldEqual(collectionDescription); //cleanup await client.Delete(TestData.ProjectId, collectionKey: collection.Key); }