Exemple #1
0
        private Task <StorageAccountGetResponse> CreateGetResponse(string serviceName)
        {
            Task <StorageAccountGetResponse> resultTask;
            var data = accounts.FirstOrDefault(a => a.Name == serviceName);

            if (data != null)
            {
                var storageServiceGetResponse = new StorageAccountGetResponse
                {
                    StorageAccount = new StorageAccount
                    {
                        Name       = data.Name,
                        Properties = new StorageAccountProperties
                        {
                            Endpoints =
                            {
                                new Uri(data.BlobEndpoint),
                                new Uri(data.QueueEndpoint),
                                new Uri(data.TableEndpoint)
                            }
                        }
                    }
                };
                resultTask = Tasks.FromResult(storageServiceGetResponse);
            }
            else
            {
                resultTask = Tasks.FromException <StorageAccountGetResponse>(ClientMocks.Make404Exception());
            }
            return(resultTask);
        }
Exemple #2
0
        private Task <StorageAccountGetKeysResponse> CreateGetKeysResponse(string serviceName)
        {
            Task <StorageAccountGetKeysResponse> resultTask;
            var data = accounts.FirstOrDefault(a => a.Name == serviceName);

            if (data != null)
            {
                var response = new StorageAccountGetKeysResponse
                {
                    PrimaryKey   = data.PrimaryKey,
                    SecondaryKey = data.SecondaryKey,
                    StatusCode   = HttpStatusCode.OK
                };
                resultTask = Tasks.FromResult(response);
            }
            else
            {
                resultTask = Tasks.FromException <StorageAccountGetKeysResponse>(ClientMocks.Make404Exception());
            }
            return(resultTask);
        }