// ------------------------------------------------------------------------------
//
// This code was generated by a tool.
// Runtime Version: 17.0.0.0
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
// ------------------------------------------------------------------------------
namespace ServiceClientGenerator.Generators.TestFiles
{
using System.IO;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using System;
///
/// Class to produce the template output
///
#line 1 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\JsonMarshallingTests.tt"
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")]
public partial class JsonMarshallingTests : Generators.BaseGenerator
{
#line hidden
///
/// Create the template output
///
public override string TransformText()
{
#line 7 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\JsonMarshallingTests.tt"
AddLicenseHeader();
#line default
#line hidden
this.Write("\r\n\r\nusing System;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Text;\r\nusin" +
"g Microsoft.VisualStudio.TestTools.UnitTesting;\r\n\r\nusing ");
#line 18 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\JsonMarshallingTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(this.Config.Namespace));
#line default
#line hidden
this.Write(";\r\nusing ");
#line 19 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\JsonMarshallingTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(this.Config.Namespace));
#line default
#line hidden
this.Write(".Model;\r\nusing ");
#line 20 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\JsonMarshallingTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(this.Config.Namespace));
#line default
#line hidden
this.Write(".Model.Internal.MarshallTransformations;\r\nusing Amazon.Runtime.Internal.Transform" +
";\r\n\r\nusing ServiceClientGenerator;\r\n\r\nusing AWSSDK_DotNet35.UnitTests.TestTools;" +
"\r\n\r\nnamespace AWSSDK_DotNet35.UnitTests.Marshalling\r\n{\r\n [TestClass]\r\n pub" +
"lic class ");
#line 30 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\JsonMarshallingTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(this.Config.ClassName));
#line default
#line hidden
this.Write("MarshallingTests\r\n {\r\n static readonly ServiceModel service_model = Uti" +
"ls.LoadServiceModel(\"");
#line 32 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\JsonMarshallingTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(this.Config.ServiceDirectoryName));
#line default
#line hidden
this.Write("\");\r\n\t\t");
#line 33 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\JsonMarshallingTests.tt"
foreach(var operation in this.Config.ServiceModel.Operations)
{
#line default
#line hidden
this.Write("\r\n [TestMethod]\r\n [TestCategory(\"UnitTest\")]\r\n [TestCategory" +
"(\"");
#line 40 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\JsonMarshallingTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(this.Config.ServiceModel.Type));
#line default
#line hidden
this.Write("\")]\r\n [TestCategory(\"");
#line 41 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\JsonMarshallingTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(this.Config.TestCategory));
#line default
#line hidden
this.Write("\")]\r\n public void ");
#line 42 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\JsonMarshallingTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(operation.Name));
#line default
#line hidden
this.Write("MarshallTest()\r\n {\r\n var request = InstantiateClassGenerator.Ex" +
"ecute<");
#line 44 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\JsonMarshallingTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(operation.Name));
#line default
#line hidden
this.Write("Request>();\r\n var marshaller = new ");
#line 45 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\JsonMarshallingTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(operation.Name));
#line default
#line hidden
this.Write("RequestMarshaller();\r\n\r\n var internalRequest = marshaller.Marshall(req" +
"uest);\r\n");
#line 48 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\JsonMarshallingTests.tt"
if(operation.RequestStructure != null)
{
#line default
#line hidden
this.Write(" var jsonRequest = UTF8Encoding.UTF8.GetString(internalRequest.Content" +
");\r\n\t\t\tComparer.CompareObjectToJson<");
#line 53 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\JsonMarshallingTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(operation.Name));
#line default
#line hidden
this.Write("Request>(request,jsonRequest);\r\n\r\n");
#line 55 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\JsonMarshallingTests.tt"
}
if(operation.ResponseStructure != null)
{
#line default
#line hidden
this.Write(@" var webResponse = new WebResponseData
{
Headers = {
{""x-amzn-RequestId"", Guid.NewGuid().ToString()},
{""x-amz-crc32"",""0""}
}
};
var jsonResponse = new JsonSampleGenerator(service_model, service_model.FindOperation(""");
#line 68 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\JsonMarshallingTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(operation.Name));
#line default
#line hidden
this.Write(@""").ResponseStructure).Execute();
webResponse.Headers.Add(""Content-Length"", UTF8Encoding.UTF8.GetBytes(jsonResponse).Length.ToString());
UnmarshallerContext context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(jsonResponse), false, webResponse);
var response = ");
#line 71 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\JsonMarshallingTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(operation.Name));
#line default
#line hidden
this.Write("ResponseUnmarshaller.Instance.Unmarshall(context) as ");
#line 71 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\JsonMarshallingTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(operation.Name));
#line default
#line hidden
this.Write("Response;\r\n\t\t\tInstantiateClassGenerator.ValidateObjectFullyInstantiated(response)" +
";\r\n");
#line 73 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\JsonMarshallingTests.tt"
}
#line default
#line hidden
this.Write(" }\r\n");
#line 77 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\JsonMarshallingTests.tt"
foreach (var exception in operation.Exceptions)
{
#line default
#line hidden
this.Write("\r\n [TestMethod]\r\n [TestCategory(\"UnitTest\")]\r\n [TestCategory" +
"(\"");
#line 84 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\JsonMarshallingTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(this.Config.ServiceModel.Type));
#line default
#line hidden
this.Write("\")]\r\n [TestCategory(\"");
#line 85 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\JsonMarshallingTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(this.Config.TestCategory));
#line default
#line hidden
this.Write("\")]\r\n public void ");
#line 86 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\JsonMarshallingTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(operation.Name));
#line default
#line hidden
this.Write("_");
#line 86 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\JsonMarshallingTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(exception.Name));
#line default
#line hidden
this.Write("MarshallTest()\r\n {\r\n var operation = service_model.FindOperati" +
"on(\"");
#line 88 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\JsonMarshallingTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(operation.Name));
#line default
#line hidden
this.Write("\");\r\n\r\n var request = InstantiateClassGenerator.Execute<");
#line 90 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\JsonMarshallingTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(operation.Name));
#line default
#line hidden
this.Write("Request>();\r\n var marshaller = new ");
#line 91 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\JsonMarshallingTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(operation.Name));
#line default
#line hidden
this.Write("RequestMarshaller();\r\n var internalRequest = marshaller.Marshall(reque" +
"st);\r\n var jsonRequest = UTF8Encoding.UTF8.GetString(internalRequest." +
"Content);\r\n\r\n Comparer.CompareObjectToJson<");
#line 95 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\JsonMarshallingTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(operation.Name));
#line default
#line hidden
this.Write("Request>(request,jsonRequest);\r\n\r\n var exception = operation.Exception" +
"s.First(e => e.Name.Equals(\"");
#line 97 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\JsonMarshallingTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(exception.Name));
#line default
#line hidden
this.Write(@"""));
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"",""");
#line 104 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\JsonMarshallingTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(exception.Name));
#line default
#line hidden
this.Write(@"""},
{""Content-Length"", UTF8Encoding.UTF8.GetBytes(jsonResponse).Length.ToString()}
}
};
var context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(jsonResponse), true, webResponse, true);
var response = ");
#line 109 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\JsonMarshallingTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(operation.Name));
#line default
#line hidden
this.Write("ResponseUnmarshaller.Instance.UnmarshallException(context, null, System.Net.HttpS" +
"tatusCode.OK);\r\n\r\n InstantiateClassGenerator.ValidateObjectFullyInsta" +
"ntiated(response);\r\n }\r\n");
#line 113 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\JsonMarshallingTests.tt"
}
}
#line default
#line hidden
this.Write(" }\r\n}");
return this.GenerationEnvironment.ToString();
}
}
#line default
#line hidden
}