public void NoPayloadMarshallTest()
        {
            var operation = service_model.FindOperation("NoPayload");

            var request    = InstantiateClassGenerator.Execute <NoPayloadRequest>();
            var marshaller = new NoPayloadRequestMarshaller();

            var internalRequest = marshaller.Marshall(request);

            TestTools.RequestValidator.Validate("NoPayload", request, internalRequest, service_model);

            var webResponse = new WebResponseData
            {
                Headers =
                {
                    { "x-amzn-RequestId", Guid.NewGuid().ToString() },
                    { "x-amz-crc32",      "0"                       }
                }
            };

            var payloadResponse = new JsonSampleGenerator(service_model, operation.ResponseStructure).Execute();

            webResponse.Headers["Content-Length"] = UTF8Encoding.UTF8.GetBytes(payloadResponse).Length.ToString();
            var context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(payloadResponse), false, webResponse);
            ResponseUnmarshaller unmarshaller = NoPayloadResponseUnmarshaller.Instance;
            var response = unmarshaller.Unmarshall(context) as NoPayloadResponse;

            InstantiateClassGenerator.ValidateObjectFullyInstantiated(response);
        }
Пример #2
0
        public void TestNoPayloadTest()
        {
            var request         = new NoPayloadRequest();
            var marshaller      = new NoPayloadRequestMarshaller();
            var internalRequest = marshaller.Marshall(request);

            Assert.IsFalse(internalRequest.Headers.ContainsKey("Content-Length"));
            Assert.IsFalse(internalRequest.Headers.ContainsKey("Content-Type"));
            Assert.IsNull(internalRequest.Content);
        }