public void GetDatasetMetadataAsync(string datasetName, AmazonCognitoSyncCallback <DatasetMetadata> callback, AsyncOptions options = null)
        {
            options = options ?? new AsyncOptions();

            DescribeDatasetRequest request = new DescribeDatasetRequest();

            request.IdentityPoolId = identityPoolId;
            request.IdentityId     = this.GetCurrentIdentityId();
            request.DatasetName    = datasetName;

            client.DescribeDatasetAsync(request, (responseObj) =>
            {
                Exception dataStorageException = null;
                DatasetMetadata metadata       = null;
                if (responseObj.Exception != null)
                {
                    dataStorageException = new DataStorageException("Failed to get metadata of dataset: "
                                                                    + datasetName, responseObj.Exception);
                }
                else
                {
                    metadata = ModelToDatasetMetadata(responseObj.Response.Dataset);
                }

                InternalSDKUtils.AsyncExecutor(() => callback(new AmazonCognitoSyncResult <DatasetMetadata>(metadata, dataStorageException, responseObj.state)), options);
            },
                                        options);
        }
Exemple #2
0
        public void Inherit_Exception()
        {
            // Arrange
            var dataStorageException = new DataStorageException(new Exception());

            // Act & Assert
            Assert.IsAssignableFrom <Exception>(dataStorageException);
        }
 public void Constructor(
     DataStorageException item,
     string expectedMessage,
     Exception expectedInnerException)
 {
     // Arrange & Act & Assert
     Assert.Equal(expectedMessage, item?.Message);
     Assert.Equal(expectedInnerException, item?.InnerException);
 }
Exemple #4
0
        public void Constructor_NewItem_Created()
        {
            // Arrange
            const string message = "test exception";

            var exception            = new Exception(message);
            var dataStorageException = new DataStorageException(exception);

            // Act & Assert
            Assert.Equal(message, dataStorageException.Message);
            Assert.IsType(exception.GetType(), dataStorageException.InnerException);
        }
        public void GetDatasetMetadataAsync(string datasetName, AmazonCognitoSyncCallback<DatasetMetadata> callback, AsyncOptions options = null)
        {
            options = options ?? new AsyncOptions();

            DescribeDatasetRequest request = new DescribeDatasetRequest();
            request.IdentityPoolId = identityPoolId;
            request.IdentityId = this.GetCurrentIdentityId();
            request.DatasetName = datasetName;

            client.DescribeDatasetAsync(request, (responseObj) =>
            {
                Exception dataStorageException = null;
                DatasetMetadata metadata = null;
                if (responseObj.Exception != null)
                {
                    dataStorageException = new DataStorageException("Failed to get metadata of dataset: "
                                                                        + datasetName, responseObj.Exception);
                }
                else
                {
                    metadata = ModelToDatasetMetadata(responseObj.Response.Dataset);
                }

                InternalSDKUtils.AsyncExecutor(() => callback(new AmazonCognitoSyncResult<DatasetMetadata>(metadata, dataStorageException, responseObj.state)), options);
            },
            options);
        }