Exemplo n.º 1
0
        /// <summary>
        /// Builds a CloudTaskGetResponse object
        /// </summary>
        public static ProxyModels.CloudTaskGetResponse CreateCloudTaskGetResponse(string taskId)
        {
            ProxyModels.CloudTaskGetResponse response = new ProxyModels.CloudTaskGetResponse();
            response.StatusCode = HttpStatusCode.OK;

            ProxyModels.CloudTask task = new ProxyModels.CloudTask();
            task.Id = taskId;

            response.Task = task;

            return(response);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Fabricates a CloudTask that's in the bound state
        /// </summary>
        public static CloudTask CreateFakeBoundTask(BatchAccountContext context)
        {
            string taskId = "testTask";

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

                request.ServiceRequestFunc = (cancellationToken) =>
                {
                    ProxyModels.CloudTaskGetResponse response = new ProxyModels.CloudTaskGetResponse();
                    response.Task = new ProxyModels.CloudTask(taskId, "cmd /c dir /s");

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

            return(context.BatchOMClient.JobOperations.GetTask("jobId", taskId, additionalBehaviors: new BatchClientBehavior[] { interceptor }));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Builds a CloudTaskGetResponse object
        /// </summary>
        public static ProxyModels.CloudTaskGetResponse CreateCloudTaskGetResponse(string taskId)
        {
            ProxyModels.CloudTaskGetResponse response = new ProxyModels.CloudTaskGetResponse();
            response.StatusCode = HttpStatusCode.OK;

            ProxyModels.CloudTask task = new ProxyModels.CloudTask();
            task.Id = taskId;

            response.Task = task;

            return response;
        }