GetOne() public méthode

Get one collection from a specified project. The collection_id/collection_key parameter means that one can use either one of them - collection_id or collection_key. User API key usage permitted if read_data permission is added to specified collection through collection.authorize() or project.authorize().
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.
Résultat 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);
        }