Exemple #1
0
        /// <summary>
        /// Builds a CloudPoolGetResponse object
        /// </summary>
        public static ProxyModels.CloudPoolGetResponse CreateCloudPoolGetResponse(string poolId)
        {
            ProxyModels.CloudPoolGetResponse response = new ProxyModels.CloudPoolGetResponse();
            response.StatusCode = HttpStatusCode.OK;

            ProxyModels.CloudPool pool = new ProxyModels.CloudPool();
            pool.Id = poolId;

            response.Pool = pool;

            return(response);
        }
Exemple #2
0
        /// <summary>
        /// Fabricates a CloudPool that's in the bound state
        /// </summary>
        public static CloudPool CreateFakeBoundPool(BatchAccountContext context)
        {
            string poolId = "testPool";

            RequestInterceptor interceptor = new RequestInterceptor((baseRequest) =>
            {
                BatchRequest <ProxyModels.CloudPoolGetParameters, ProxyModels.CloudPoolGetResponse> request =
                    (BatchRequest <ProxyModels.CloudPoolGetParameters, ProxyModels.CloudPoolGetResponse>)baseRequest;

                request.ServiceRequestFunc = (cancellationToken) =>
                {
                    ProxyModels.CloudPoolGetResponse response = new ProxyModels.CloudPoolGetResponse();
                    response.Pool = new ProxyModels.CloudPool(poolId, "small", "4");

                    Task <ProxyModels.CloudPoolGetResponse> task = Task.FromResult(response);
                    return(task);
                };
            });

            return(context.BatchOMClient.PoolOperations.GetPool(poolId, additionalBehaviors: new BatchClientBehavior[] { interceptor }));
        }
        /// <summary>
        /// Builds a CloudPoolGetResponse object
        /// </summary>
        public static ProxyModels.CloudPoolGetResponse CreateCloudPoolGetResponse(string poolId)
        {
            ProxyModels.CloudPoolGetResponse response = new ProxyModels.CloudPoolGetResponse();
            response.StatusCode = HttpStatusCode.OK;

            ProxyModels.CloudPool pool = new ProxyModels.CloudPool();
            pool.Id = poolId;

            response.Pool = pool;

            return response;
        }