public static StartJobResponse Unmarshall(UnmarshallerContext _ctx)
        {
            StartJobResponse startJobResponse = new StartJobResponse();

            startJobResponse.HttpResponse   = _ctx.HttpResponse;
            startJobResponse.RequestId      = _ctx.StringValue("StartJob.RequestId");
            startJobResponse.Success        = _ctx.BooleanValue("StartJob.Success");
            startJobResponse.Code           = _ctx.StringValue("StartJob.Code");
            startJobResponse.Message        = _ctx.StringValue("StartJob.Message");
            startJobResponse.HttpStatusCode = _ctx.IntegerValue("StartJob.HttpStatusCode");

            List <StartJobResponse.StartJob_KeyValuePair> startJobResponse_taskIds = new List <StartJobResponse.StartJob_KeyValuePair>();

            for (int i = 0; i < _ctx.Length("StartJob.TaskIds.Length"); i++)
            {
                StartJobResponse.StartJob_KeyValuePair keyValuePair = new StartJobResponse.StartJob_KeyValuePair();
                keyValuePair.Key    = _ctx.StringValue("StartJob.TaskIds[" + i + "].Key");
                keyValuePair._Value = _ctx.StringValue("StartJob.TaskIds[" + i + "].Value");

                startJobResponse_taskIds.Add(keyValuePair);
            }
            startJobResponse.TaskIds = startJobResponse_taskIds;

            return(startJobResponse);
        }
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            StartJobResponse response = new StartJobResponse();


            return(response);
        }
Exemplo n.º 3
0
        private IOrchestratorClient GetMockOrchestratorClient(StartJobResponse mockResponse)
        {
            var orchestratorClient = new Mock <IOrchestratorClient>();

            orchestratorClient
            .Setup(c => c.ExecuteJobAsync(It.IsAny <StartJobInfo>()))
            .ReturnsAsync(mockResponse);
            return(orchestratorClient.Object);
        }
        public static StartJobResponse Unmarshall(UnmarshallerContext context)
        {
            StartJobResponse startJobResponse = new StartJobResponse();

            startJobResponse.HttpResponse = context.HttpResponse;
            startJobResponse.RequestId    = context.StringValue("StartJob.RequestId");
            startJobResponse.InstanceId   = context.LongValue("StartJob.InstanceId");

            return(startJobResponse);
        }
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            StartJobResponse response = new StartJobResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("jobSummary", targetDepth))
                {
                    var unmarshaller = JobSummaryUnmarshaller.Instance;
                    response.JobSummary = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
Exemplo n.º 6
0
        public void SuccessIfGetJobDetail()
        {
            var mockResponse = new StartJobResponse()
            {
                Id              = "1",
                Key             = Guid.NewGuid().ToString(),
                State           = "Successful",
                OutputArguments = "{\"key\":\"value\"}",
            };

            var mockMessageHandler = MockHelper.CreateMockMessagHandler(HttpStatusCode.OK, Utils.GetPostBody(mockResponse));

            var basicAuthHeadhandler = new BasicAuthHeadHandler(_mockTokenService, mockMessageHandler.Object);

            var httpClient = new HttpClient(basicAuthHeadhandler);

            var response = _orchestratorClient.GetJobDetailAsync("1", httpClient).GetAwaiter().GetResult();

            Assert.Equal(mockResponse.Key, response.Key);
        }