public GetOne ( string projectId, string collectionId = null, string collectionKey = null ) : Task |
||
projectId | string | Project id. |
collectionId | string | Collection id defining collection. |
collectionKey | string | Collection key defining collection. |
리턴 | Task |
public async Task GetOne_NullProjectId(CollectionSyncanoClient client) { try { //when await client.GetOne(null, TestData.CollectionId); throw new Exception("GetOne should throw an exception"); } catch (Exception e) { //then e.ShouldBeType<ArgumentNullException>(); } }
public async Task GetOne_InvalidProjectId(CollectionSyncanoClient client) { try { //when await client.GetOne("abcde", TestData.CollectionId); throw new Exception("GetOne should throw an exception"); } catch (Exception e) { //then e.ShouldBeType<SyncanoException>(); } }
public async Task GetOne_ByCollectionKey_GetsCollectionObject(CollectionSyncanoClient client) { //given string collectionName = "NewCollection test " + DateTime.Now.ToLongTimeString() + " " + DateTime.Now.ToShortDateString(); string collectionKey = "abcde"; var collection = await client.New(TestData.ProjectId, collectionName, collectionKey); await client.Activate(TestData.ProjectId, collection.Id, true); //then var result = await client.GetOne(TestData.ProjectId, collectionKey: collectionKey); //then result.ShouldNotBeNull(); result.Status.ShouldEqual(CollectionStatus.Active); result.Key.ShouldEqual(collectionKey); result.Description.ShouldBeNull(); //cleanup await client.Delete(TestData.ProjectId, collection.Id); }