/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ /* * Do not modify this file. This file is generated from the migrationhub-config-2019-06-30.normal.json service model. */ using System; using System.IO; using System.Linq; using System.Text; using Microsoft.VisualStudio.TestTools.UnitTesting; using Amazon.MigrationHubConfig; using Amazon.MigrationHubConfig.Model; using Amazon.MigrationHubConfig.Model.Internal.MarshallTransformations; using Amazon.Runtime.Internal.Transform; using ServiceClientGenerator; using AWSSDK_DotNet35.UnitTests.TestTools; namespace AWSSDK_DotNet35.UnitTests.Marshalling { [TestClass] public class MigrationHubConfigMarshallingTests { static readonly ServiceModel service_model = Utils.LoadServiceModel("migrationhub-config"); [TestMethod] [TestCategory("UnitTest")] [TestCategory("Json")] [TestCategory("MigrationHubConfig")] public void CreateHomeRegionControlMarshallTest() { var request = InstantiateClassGenerator.Execute<CreateHomeRegionControlRequest>(); var marshaller = new CreateHomeRegionControlRequestMarshaller(); var internalRequest = marshaller.Marshall(request); var jsonRequest = UTF8Encoding.UTF8.GetString(internalRequest.Content); Comparer.CompareObjectToJson<CreateHomeRegionControlRequest>(request,jsonRequest); var webResponse = new WebResponseData { Headers = { {"x-amzn-RequestId", Guid.NewGuid().ToString()}, {"x-amz-crc32","0"} } }; var jsonResponse = new JsonSampleGenerator(service_model, service_model.FindOperation("CreateHomeRegionControl").ResponseStructure).Execute(); webResponse.Headers.Add("Content-Length", UTF8Encoding.UTF8.GetBytes(jsonResponse).Length.ToString()); UnmarshallerContext context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(jsonResponse), false, webResponse); var response = CreateHomeRegionControlResponseUnmarshaller.Instance.Unmarshall(context) as CreateHomeRegionControlResponse; InstantiateClassGenerator.ValidateObjectFullyInstantiated(response); } [TestMethod] [TestCategory("UnitTest")] [TestCategory("Json")] [TestCategory("MigrationHubConfig")] public void CreateHomeRegionControl_AccessDeniedExceptionMarshallTest() { var operation = service_model.FindOperation("CreateHomeRegionControl"); var request = InstantiateClassGenerator.Execute<CreateHomeRegionControlRequest>(); var marshaller = new CreateHomeRegionControlRequestMarshaller(); var internalRequest = marshaller.Marshall(request); var jsonRequest = UTF8Encoding.UTF8.GetString(internalRequest.Content); Comparer.CompareObjectToJson<CreateHomeRegionControlRequest>(request,jsonRequest); var exception = operation.Exceptions.First(e => e.Name.Equals("AccessDeniedException")); var jsonResponse = new JsonSampleGenerator(service_model, exception).Execute(); var webResponse = new WebResponseData { Headers = { {"x-amzn-RequestId", Guid.NewGuid().ToString()}, {"x-amz-crc32","0"}, {"x-amzn-ErrorType","AccessDeniedException"}, {"Content-Length", UTF8Encoding.UTF8.GetBytes(jsonResponse).Length.ToString()} } }; var context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(jsonResponse), true, webResponse, true); var response = CreateHomeRegionControlResponseUnmarshaller.Instance.UnmarshallException(context, null, System.Net.HttpStatusCode.OK); InstantiateClassGenerator.ValidateObjectFullyInstantiated(response); } [TestMethod] [TestCategory("UnitTest")] [TestCategory("Json")] [TestCategory("MigrationHubConfig")] public void CreateHomeRegionControl_DryRunOperationExceptionMarshallTest() { var operation = service_model.FindOperation("CreateHomeRegionControl"); var request = InstantiateClassGenerator.Execute<CreateHomeRegionControlRequest>(); var marshaller = new CreateHomeRegionControlRequestMarshaller(); var internalRequest = marshaller.Marshall(request); var jsonRequest = UTF8Encoding.UTF8.GetString(internalRequest.Content); Comparer.CompareObjectToJson<CreateHomeRegionControlRequest>(request,jsonRequest); var exception = operation.Exceptions.First(e => e.Name.Equals("DryRunOperationException")); var jsonResponse = new JsonSampleGenerator(service_model, exception).Execute(); var webResponse = new WebResponseData { Headers = { {"x-amzn-RequestId", Guid.NewGuid().ToString()}, {"x-amz-crc32","0"}, {"x-amzn-ErrorType","DryRunOperationException"}, {"Content-Length", UTF8Encoding.UTF8.GetBytes(jsonResponse).Length.ToString()} } }; var context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(jsonResponse), true, webResponse, true); var response = CreateHomeRegionControlResponseUnmarshaller.Instance.UnmarshallException(context, null, System.Net.HttpStatusCode.OK); InstantiateClassGenerator.ValidateObjectFullyInstantiated(response); } [TestMethod] [TestCategory("UnitTest")] [TestCategory("Json")] [TestCategory("MigrationHubConfig")] public void CreateHomeRegionControl_InternalServerErrorExceptionMarshallTest() { var operation = service_model.FindOperation("CreateHomeRegionControl"); var request = InstantiateClassGenerator.Execute<CreateHomeRegionControlRequest>(); var marshaller = new CreateHomeRegionControlRequestMarshaller(); var internalRequest = marshaller.Marshall(request); var jsonRequest = UTF8Encoding.UTF8.GetString(internalRequest.Content); Comparer.CompareObjectToJson<CreateHomeRegionControlRequest>(request,jsonRequest); var exception = operation.Exceptions.First(e => e.Name.Equals("InternalServerErrorException")); var jsonResponse = new JsonSampleGenerator(service_model, exception).Execute(); var webResponse = new WebResponseData { Headers = { {"x-amzn-RequestId", Guid.NewGuid().ToString()}, {"x-amz-crc32","0"}, {"x-amzn-ErrorType","InternalServerErrorException"}, {"Content-Length", UTF8Encoding.UTF8.GetBytes(jsonResponse).Length.ToString()} } }; var context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(jsonResponse), true, webResponse, true); var response = CreateHomeRegionControlResponseUnmarshaller.Instance.UnmarshallException(context, null, System.Net.HttpStatusCode.OK); InstantiateClassGenerator.ValidateObjectFullyInstantiated(response); } [TestMethod] [TestCategory("UnitTest")] [TestCategory("Json")] [TestCategory("MigrationHubConfig")] public void CreateHomeRegionControl_InvalidInputExceptionMarshallTest() { var operation = service_model.FindOperation("CreateHomeRegionControl"); var request = InstantiateClassGenerator.Execute<CreateHomeRegionControlRequest>(); var marshaller = new CreateHomeRegionControlRequestMarshaller(); var internalRequest = marshaller.Marshall(request); var jsonRequest = UTF8Encoding.UTF8.GetString(internalRequest.Content); Comparer.CompareObjectToJson<CreateHomeRegionControlRequest>(request,jsonRequest); var exception = operation.Exceptions.First(e => e.Name.Equals("InvalidInputException")); var jsonResponse = new JsonSampleGenerator(service_model, exception).Execute(); var webResponse = new WebResponseData { Headers = { {"x-amzn-RequestId", Guid.NewGuid().ToString()}, {"x-amz-crc32","0"}, {"x-amzn-ErrorType","InvalidInputException"}, {"Content-Length", UTF8Encoding.UTF8.GetBytes(jsonResponse).Length.ToString()} } }; var context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(jsonResponse), true, webResponse, true); var response = CreateHomeRegionControlResponseUnmarshaller.Instance.UnmarshallException(context, null, System.Net.HttpStatusCode.OK); InstantiateClassGenerator.ValidateObjectFullyInstantiated(response); } [TestMethod] [TestCategory("UnitTest")] [TestCategory("Json")] [TestCategory("MigrationHubConfig")] public void CreateHomeRegionControl_ServiceUnavailableExceptionMarshallTest() { var operation = service_model.FindOperation("CreateHomeRegionControl"); var request = InstantiateClassGenerator.Execute<CreateHomeRegionControlRequest>(); var marshaller = new CreateHomeRegionControlRequestMarshaller(); var internalRequest = marshaller.Marshall(request); var jsonRequest = UTF8Encoding.UTF8.GetString(internalRequest.Content); Comparer.CompareObjectToJson<CreateHomeRegionControlRequest>(request,jsonRequest); var exception = operation.Exceptions.First(e => e.Name.Equals("ServiceUnavailableException")); var jsonResponse = new JsonSampleGenerator(service_model, exception).Execute(); var webResponse = new WebResponseData { Headers = { {"x-amzn-RequestId", Guid.NewGuid().ToString()}, {"x-amz-crc32","0"}, {"x-amzn-ErrorType","ServiceUnavailableException"}, {"Content-Length", UTF8Encoding.UTF8.GetBytes(jsonResponse).Length.ToString()} } }; var context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(jsonResponse), true, webResponse, true); var response = CreateHomeRegionControlResponseUnmarshaller.Instance.UnmarshallException(context, null, System.Net.HttpStatusCode.OK); InstantiateClassGenerator.ValidateObjectFullyInstantiated(response); } [TestMethod] [TestCategory("UnitTest")] [TestCategory("Json")] [TestCategory("MigrationHubConfig")] public void CreateHomeRegionControl_ThrottlingExceptionMarshallTest() { var operation = service_model.FindOperation("CreateHomeRegionControl"); var request = InstantiateClassGenerator.Execute<CreateHomeRegionControlRequest>(); var marshaller = new CreateHomeRegionControlRequestMarshaller(); var internalRequest = marshaller.Marshall(request); var jsonRequest = UTF8Encoding.UTF8.GetString(internalRequest.Content); Comparer.CompareObjectToJson<CreateHomeRegionControlRequest>(request,jsonRequest); var exception = operation.Exceptions.First(e => e.Name.Equals("ThrottlingException")); var jsonResponse = new JsonSampleGenerator(service_model, exception).Execute(); var webResponse = new WebResponseData { Headers = { {"x-amzn-RequestId", Guid.NewGuid().ToString()}, {"x-amz-crc32","0"}, {"x-amzn-ErrorType","ThrottlingException"}, {"Content-Length", UTF8Encoding.UTF8.GetBytes(jsonResponse).Length.ToString()} } }; var context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(jsonResponse), true, webResponse, true); var response = CreateHomeRegionControlResponseUnmarshaller.Instance.UnmarshallException(context, null, System.Net.HttpStatusCode.OK); InstantiateClassGenerator.ValidateObjectFullyInstantiated(response); } [TestMethod] [TestCategory("UnitTest")] [TestCategory("Json")] [TestCategory("MigrationHubConfig")] public void DescribeHomeRegionControlsMarshallTest() { var request = InstantiateClassGenerator.Execute<DescribeHomeRegionControlsRequest>(); var marshaller = new DescribeHomeRegionControlsRequestMarshaller(); var internalRequest = marshaller.Marshall(request); var jsonRequest = UTF8Encoding.UTF8.GetString(internalRequest.Content); Comparer.CompareObjectToJson<DescribeHomeRegionControlsRequest>(request,jsonRequest); var webResponse = new WebResponseData { Headers = { {"x-amzn-RequestId", Guid.NewGuid().ToString()}, {"x-amz-crc32","0"} } }; var jsonResponse = new JsonSampleGenerator(service_model, service_model.FindOperation("DescribeHomeRegionControls").ResponseStructure).Execute(); webResponse.Headers.Add("Content-Length", UTF8Encoding.UTF8.GetBytes(jsonResponse).Length.ToString()); UnmarshallerContext context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(jsonResponse), false, webResponse); var response = DescribeHomeRegionControlsResponseUnmarshaller.Instance.Unmarshall(context) as DescribeHomeRegionControlsResponse; InstantiateClassGenerator.ValidateObjectFullyInstantiated(response); } [TestMethod] [TestCategory("UnitTest")] [TestCategory("Json")] [TestCategory("MigrationHubConfig")] public void DescribeHomeRegionControls_AccessDeniedExceptionMarshallTest() { var operation = service_model.FindOperation("DescribeHomeRegionControls"); var request = InstantiateClassGenerator.Execute<DescribeHomeRegionControlsRequest>(); var marshaller = new DescribeHomeRegionControlsRequestMarshaller(); var internalRequest = marshaller.Marshall(request); var jsonRequest = UTF8Encoding.UTF8.GetString(internalRequest.Content); Comparer.CompareObjectToJson<DescribeHomeRegionControlsRequest>(request,jsonRequest); var exception = operation.Exceptions.First(e => e.Name.Equals("AccessDeniedException")); var jsonResponse = new JsonSampleGenerator(service_model, exception).Execute(); var webResponse = new WebResponseData { Headers = { {"x-amzn-RequestId", Guid.NewGuid().ToString()}, {"x-amz-crc32","0"}, {"x-amzn-ErrorType","AccessDeniedException"}, {"Content-Length", UTF8Encoding.UTF8.GetBytes(jsonResponse).Length.ToString()} } }; var context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(jsonResponse), true, webResponse, true); var response = DescribeHomeRegionControlsResponseUnmarshaller.Instance.UnmarshallException(context, null, System.Net.HttpStatusCode.OK); InstantiateClassGenerator.ValidateObjectFullyInstantiated(response); } [TestMethod] [TestCategory("UnitTest")] [TestCategory("Json")] [TestCategory("MigrationHubConfig")] public void DescribeHomeRegionControls_InternalServerErrorExceptionMarshallTest() { var operation = service_model.FindOperation("DescribeHomeRegionControls"); var request = InstantiateClassGenerator.Execute<DescribeHomeRegionControlsRequest>(); var marshaller = new DescribeHomeRegionControlsRequestMarshaller(); var internalRequest = marshaller.Marshall(request); var jsonRequest = UTF8Encoding.UTF8.GetString(internalRequest.Content); Comparer.CompareObjectToJson<DescribeHomeRegionControlsRequest>(request,jsonRequest); var exception = operation.Exceptions.First(e => e.Name.Equals("InternalServerErrorException")); var jsonResponse = new JsonSampleGenerator(service_model, exception).Execute(); var webResponse = new WebResponseData { Headers = { {"x-amzn-RequestId", Guid.NewGuid().ToString()}, {"x-amz-crc32","0"}, {"x-amzn-ErrorType","InternalServerErrorException"}, {"Content-Length", UTF8Encoding.UTF8.GetBytes(jsonResponse).Length.ToString()} } }; var context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(jsonResponse), true, webResponse, true); var response = DescribeHomeRegionControlsResponseUnmarshaller.Instance.UnmarshallException(context, null, System.Net.HttpStatusCode.OK); InstantiateClassGenerator.ValidateObjectFullyInstantiated(response); } [TestMethod] [TestCategory("UnitTest")] [TestCategory("Json")] [TestCategory("MigrationHubConfig")] public void DescribeHomeRegionControls_InvalidInputExceptionMarshallTest() { var operation = service_model.FindOperation("DescribeHomeRegionControls"); var request = InstantiateClassGenerator.Execute<DescribeHomeRegionControlsRequest>(); var marshaller = new DescribeHomeRegionControlsRequestMarshaller(); var internalRequest = marshaller.Marshall(request); var jsonRequest = UTF8Encoding.UTF8.GetString(internalRequest.Content); Comparer.CompareObjectToJson<DescribeHomeRegionControlsRequest>(request,jsonRequest); var exception = operation.Exceptions.First(e => e.Name.Equals("InvalidInputException")); var jsonResponse = new JsonSampleGenerator(service_model, exception).Execute(); var webResponse = new WebResponseData { Headers = { {"x-amzn-RequestId", Guid.NewGuid().ToString()}, {"x-amz-crc32","0"}, {"x-amzn-ErrorType","InvalidInputException"}, {"Content-Length", UTF8Encoding.UTF8.GetBytes(jsonResponse).Length.ToString()} } }; var context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(jsonResponse), true, webResponse, true); var response = DescribeHomeRegionControlsResponseUnmarshaller.Instance.UnmarshallException(context, null, System.Net.HttpStatusCode.OK); InstantiateClassGenerator.ValidateObjectFullyInstantiated(response); } [TestMethod] [TestCategory("UnitTest")] [TestCategory("Json")] [TestCategory("MigrationHubConfig")] public void DescribeHomeRegionControls_ServiceUnavailableExceptionMarshallTest() { var operation = service_model.FindOperation("DescribeHomeRegionControls"); var request = InstantiateClassGenerator.Execute<DescribeHomeRegionControlsRequest>(); var marshaller = new DescribeHomeRegionControlsRequestMarshaller(); var internalRequest = marshaller.Marshall(request); var jsonRequest = UTF8Encoding.UTF8.GetString(internalRequest.Content); Comparer.CompareObjectToJson<DescribeHomeRegionControlsRequest>(request,jsonRequest); var exception = operation.Exceptions.First(e => e.Name.Equals("ServiceUnavailableException")); var jsonResponse = new JsonSampleGenerator(service_model, exception).Execute(); var webResponse = new WebResponseData { Headers = { {"x-amzn-RequestId", Guid.NewGuid().ToString()}, {"x-amz-crc32","0"}, {"x-amzn-ErrorType","ServiceUnavailableException"}, {"Content-Length", UTF8Encoding.UTF8.GetBytes(jsonResponse).Length.ToString()} } }; var context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(jsonResponse), true, webResponse, true); var response = DescribeHomeRegionControlsResponseUnmarshaller.Instance.UnmarshallException(context, null, System.Net.HttpStatusCode.OK); InstantiateClassGenerator.ValidateObjectFullyInstantiated(response); } [TestMethod] [TestCategory("UnitTest")] [TestCategory("Json")] [TestCategory("MigrationHubConfig")] public void DescribeHomeRegionControls_ThrottlingExceptionMarshallTest() { var operation = service_model.FindOperation("DescribeHomeRegionControls"); var request = InstantiateClassGenerator.Execute<DescribeHomeRegionControlsRequest>(); var marshaller = new DescribeHomeRegionControlsRequestMarshaller(); var internalRequest = marshaller.Marshall(request); var jsonRequest = UTF8Encoding.UTF8.GetString(internalRequest.Content); Comparer.CompareObjectToJson<DescribeHomeRegionControlsRequest>(request,jsonRequest); var exception = operation.Exceptions.First(e => e.Name.Equals("ThrottlingException")); var jsonResponse = new JsonSampleGenerator(service_model, exception).Execute(); var webResponse = new WebResponseData { Headers = { {"x-amzn-RequestId", Guid.NewGuid().ToString()}, {"x-amz-crc32","0"}, {"x-amzn-ErrorType","ThrottlingException"}, {"Content-Length", UTF8Encoding.UTF8.GetBytes(jsonResponse).Length.ToString()} } }; var context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(jsonResponse), true, webResponse, true); var response = DescribeHomeRegionControlsResponseUnmarshaller.Instance.UnmarshallException(context, null, System.Net.HttpStatusCode.OK); InstantiateClassGenerator.ValidateObjectFullyInstantiated(response); } [TestMethod] [TestCategory("UnitTest")] [TestCategory("Json")] [TestCategory("MigrationHubConfig")] public void GetHomeRegionMarshallTest() { var request = InstantiateClassGenerator.Execute<GetHomeRegionRequest>(); var marshaller = new GetHomeRegionRequestMarshaller(); var internalRequest = marshaller.Marshall(request); var jsonRequest = UTF8Encoding.UTF8.GetString(internalRequest.Content); Comparer.CompareObjectToJson<GetHomeRegionRequest>(request,jsonRequest); var webResponse = new WebResponseData { Headers = { {"x-amzn-RequestId", Guid.NewGuid().ToString()}, {"x-amz-crc32","0"} } }; var jsonResponse = new JsonSampleGenerator(service_model, service_model.FindOperation("GetHomeRegion").ResponseStructure).Execute(); webResponse.Headers.Add("Content-Length", UTF8Encoding.UTF8.GetBytes(jsonResponse).Length.ToString()); UnmarshallerContext context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(jsonResponse), false, webResponse); var response = GetHomeRegionResponseUnmarshaller.Instance.Unmarshall(context) as GetHomeRegionResponse; InstantiateClassGenerator.ValidateObjectFullyInstantiated(response); } [TestMethod] [TestCategory("UnitTest")] [TestCategory("Json")] [TestCategory("MigrationHubConfig")] public void GetHomeRegion_AccessDeniedExceptionMarshallTest() { var operation = service_model.FindOperation("GetHomeRegion"); var request = InstantiateClassGenerator.Execute<GetHomeRegionRequest>(); var marshaller = new GetHomeRegionRequestMarshaller(); var internalRequest = marshaller.Marshall(request); var jsonRequest = UTF8Encoding.UTF8.GetString(internalRequest.Content); Comparer.CompareObjectToJson<GetHomeRegionRequest>(request,jsonRequest); var exception = operation.Exceptions.First(e => e.Name.Equals("AccessDeniedException")); var jsonResponse = new JsonSampleGenerator(service_model, exception).Execute(); var webResponse = new WebResponseData { Headers = { {"x-amzn-RequestId", Guid.NewGuid().ToString()}, {"x-amz-crc32","0"}, {"x-amzn-ErrorType","AccessDeniedException"}, {"Content-Length", UTF8Encoding.UTF8.GetBytes(jsonResponse).Length.ToString()} } }; var context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(jsonResponse), true, webResponse, true); var response = GetHomeRegionResponseUnmarshaller.Instance.UnmarshallException(context, null, System.Net.HttpStatusCode.OK); InstantiateClassGenerator.ValidateObjectFullyInstantiated(response); } [TestMethod] [TestCategory("UnitTest")] [TestCategory("Json")] [TestCategory("MigrationHubConfig")] public void GetHomeRegion_InternalServerErrorExceptionMarshallTest() { var operation = service_model.FindOperation("GetHomeRegion"); var request = InstantiateClassGenerator.Execute<GetHomeRegionRequest>(); var marshaller = new GetHomeRegionRequestMarshaller(); var internalRequest = marshaller.Marshall(request); var jsonRequest = UTF8Encoding.UTF8.GetString(internalRequest.Content); Comparer.CompareObjectToJson<GetHomeRegionRequest>(request,jsonRequest); var exception = operation.Exceptions.First(e => e.Name.Equals("InternalServerErrorException")); var jsonResponse = new JsonSampleGenerator(service_model, exception).Execute(); var webResponse = new WebResponseData { Headers = { {"x-amzn-RequestId", Guid.NewGuid().ToString()}, {"x-amz-crc32","0"}, {"x-amzn-ErrorType","InternalServerErrorException"}, {"Content-Length", UTF8Encoding.UTF8.GetBytes(jsonResponse).Length.ToString()} } }; var context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(jsonResponse), true, webResponse, true); var response = GetHomeRegionResponseUnmarshaller.Instance.UnmarshallException(context, null, System.Net.HttpStatusCode.OK); InstantiateClassGenerator.ValidateObjectFullyInstantiated(response); } [TestMethod] [TestCategory("UnitTest")] [TestCategory("Json")] [TestCategory("MigrationHubConfig")] public void GetHomeRegion_InvalidInputExceptionMarshallTest() { var operation = service_model.FindOperation("GetHomeRegion"); var request = InstantiateClassGenerator.Execute<GetHomeRegionRequest>(); var marshaller = new GetHomeRegionRequestMarshaller(); var internalRequest = marshaller.Marshall(request); var jsonRequest = UTF8Encoding.UTF8.GetString(internalRequest.Content); Comparer.CompareObjectToJson<GetHomeRegionRequest>(request,jsonRequest); var exception = operation.Exceptions.First(e => e.Name.Equals("InvalidInputException")); var jsonResponse = new JsonSampleGenerator(service_model, exception).Execute(); var webResponse = new WebResponseData { Headers = { {"x-amzn-RequestId", Guid.NewGuid().ToString()}, {"x-amz-crc32","0"}, {"x-amzn-ErrorType","InvalidInputException"}, {"Content-Length", UTF8Encoding.UTF8.GetBytes(jsonResponse).Length.ToString()} } }; var context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(jsonResponse), true, webResponse, true); var response = GetHomeRegionResponseUnmarshaller.Instance.UnmarshallException(context, null, System.Net.HttpStatusCode.OK); InstantiateClassGenerator.ValidateObjectFullyInstantiated(response); } [TestMethod] [TestCategory("UnitTest")] [TestCategory("Json")] [TestCategory("MigrationHubConfig")] public void GetHomeRegion_ServiceUnavailableExceptionMarshallTest() { var operation = service_model.FindOperation("GetHomeRegion"); var request = InstantiateClassGenerator.Execute<GetHomeRegionRequest>(); var marshaller = new GetHomeRegionRequestMarshaller(); var internalRequest = marshaller.Marshall(request); var jsonRequest = UTF8Encoding.UTF8.GetString(internalRequest.Content); Comparer.CompareObjectToJson<GetHomeRegionRequest>(request,jsonRequest); var exception = operation.Exceptions.First(e => e.Name.Equals("ServiceUnavailableException")); var jsonResponse = new JsonSampleGenerator(service_model, exception).Execute(); var webResponse = new WebResponseData { Headers = { {"x-amzn-RequestId", Guid.NewGuid().ToString()}, {"x-amz-crc32","0"}, {"x-amzn-ErrorType","ServiceUnavailableException"}, {"Content-Length", UTF8Encoding.UTF8.GetBytes(jsonResponse).Length.ToString()} } }; var context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(jsonResponse), true, webResponse, true); var response = GetHomeRegionResponseUnmarshaller.Instance.UnmarshallException(context, null, System.Net.HttpStatusCode.OK); InstantiateClassGenerator.ValidateObjectFullyInstantiated(response); } [TestMethod] [TestCategory("UnitTest")] [TestCategory("Json")] [TestCategory("MigrationHubConfig")] public void GetHomeRegion_ThrottlingExceptionMarshallTest() { var operation = service_model.FindOperation("GetHomeRegion"); var request = InstantiateClassGenerator.Execute<GetHomeRegionRequest>(); var marshaller = new GetHomeRegionRequestMarshaller(); var internalRequest = marshaller.Marshall(request); var jsonRequest = UTF8Encoding.UTF8.GetString(internalRequest.Content); Comparer.CompareObjectToJson<GetHomeRegionRequest>(request,jsonRequest); var exception = operation.Exceptions.First(e => e.Name.Equals("ThrottlingException")); var jsonResponse = new JsonSampleGenerator(service_model, exception).Execute(); var webResponse = new WebResponseData { Headers = { {"x-amzn-RequestId", Guid.NewGuid().ToString()}, {"x-amz-crc32","0"}, {"x-amzn-ErrorType","ThrottlingException"}, {"Content-Length", UTF8Encoding.UTF8.GetBytes(jsonResponse).Length.ToString()} } }; var context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(jsonResponse), true, webResponse, true); var response = GetHomeRegionResponseUnmarshaller.Instance.UnmarshallException(context, null, System.Net.HttpStatusCode.OK); InstantiateClassGenerator.ValidateObjectFullyInstantiated(response); } } }