// ------------------------------------------------------------------------------
//
// 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\PaginatorTests.tt"
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")]
public partial class PaginatorTests : Generators.BaseGenerator
{
#line hidden
///
/// Create the template output
///
public override string TransformText()
{
#line 7 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\PaginatorTests.tt"
AddLicenseHeader();
#line default
#line hidden
this.Write("\r\nusing ");
#line 11 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\PaginatorTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(this.Config.Namespace));
#line default
#line hidden
this.Write(";\r\nusing ");
#line 12 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\PaginatorTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(this.Config.Namespace));
#line default
#line hidden
this.Write(".Model;\r\n\r\nusing Moq;\r\nusing System;\r\nusing System.Linq;\r\nusing AWSSDK_DotNet35.U" +
"nitTests.TestTools;\r\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\r\n\r\nname" +
"space AWSSDK_DotNet35.UnitTests.PaginatorTests\r\n{\r\n [TestClass]\r\n public c" +
"lass ");
#line 23 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\PaginatorTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(this.Config.ClassName));
#line default
#line hidden
this.Write("PaginatorTests\r\n {\r\n private static Mock _mockClient;\r\n\r\n [ClassInitialize()]\r\n public static void C" +
"lassInitialize(TestContext a)\r\n {\r\n _mockClient = new Mock(\"access key\", \"secret\", Amazon.RegionEndpoint.USEast1);\r\n }\r\n");
#line 32 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\PaginatorTests.tt"
foreach(var operation in this.Config.ServiceModel.Operations)
{
if (operation.Paginators != null && !operation.UnsupportedPaginatorConfig)
{
#line default
#line hidden
this.Write("\r\n [TestMethod]\r\n [TestCategory(\"UnitTest\")]\r\n [TestCategory" +
"(\"");
#line 41 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\PaginatorTests.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\PaginatorTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(operation.Name));
#line default
#line hidden
this.Write("Test_TwoPages()\r\n {\r\n var request = InstantiateClassGenerator.E" +
"xecute<");
#line 44 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\PaginatorTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(operation.Name));
#line default
#line hidden
this.Write("Request>();\r\n\r\n var firstResponse = InstantiateClassGenerator.Execute<" +
"");
#line 46 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\PaginatorTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(operation.Name));
#line default
#line hidden
this.Write("Response>();\r\n var secondResponse = InstantiateClassGenerator.Execute<" +
"");
#line 47 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\PaginatorTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(operation.Name));
#line default
#line hidden
this.Write("Response>();\r\n");
#line 48 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\PaginatorTests.tt"
if (operation.Paginators.MoreResults != null)
{
#line default
#line hidden
this.Write(" secondResponse.");
#line 52 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\PaginatorTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(operation.Paginators.MoreResults.PropertyName));
#line default
#line hidden
this.Write(" = false;\r\n");
#line 53 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\PaginatorTests.tt"
}
else if (operation.Paginators.InputTokens[0].IsListOrDict)
{
#line default
#line hidden
this.Write(" secondResponse.");
#line 58 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\PaginatorTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(operation.Paginators.OutputTokens[0].PropertyName));
#line default
#line hidden
this.Write(".Clear();\r\n");
#line 59 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\PaginatorTests.tt"
}
else
{
#line default
#line hidden
this.Write(" secondResponse.");
#line 64 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\PaginatorTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(operation.Paginators.OutputTokens[0].PropertyName));
#line default
#line hidden
this.Write(" = null;\r\n");
#line 65 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\PaginatorTests.tt"
}
#line default
#line hidden
this.Write("\r\n _mockClient.SetupSequence(x => x.");
#line 69 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\PaginatorTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(operation.Name));
#line default
#line hidden
this.Write("(request)).Returns(firstResponse).Returns(secondResponse);\r\n var pagin" +
"ator = _mockClient.Object.Paginators.");
#line 70 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\PaginatorTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(operation.Name));
#line default
#line hidden
this.Write("(request);\r\n \r\n Assert.AreEqual(2, paginator.Responses.ToLi" +
"st().Count);\r\n }\r\n\r\n [TestMethod]\r\n [TestCategory(\"UnitTest" +
"\")]\r\n [TestCategory(\"");
#line 77 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\PaginatorTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(this.Config.TestCategory));
#line default
#line hidden
this.Write("\")]\r\n [ExpectedException(typeof(System.InvalidOperationException), \"Pagina" +
"tor has already been consumed and cannot be reused. Please create a new instance" +
".\")]\r\n public void ");
#line 79 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\PaginatorTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(operation.Name));
#line default
#line hidden
this.Write("Test__OnlyUsedOnce()\r\n {\r\n var request = InstantiateClassGenera" +
"tor.Execute<");
#line 81 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\PaginatorTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(operation.Name));
#line default
#line hidden
this.Write("Request>();\r\n\r\n var response = InstantiateClassGenerator.Execute<");
#line 83 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\PaginatorTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(operation.Name));
#line default
#line hidden
this.Write("Response>();\r\n");
#line 84 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\PaginatorTests.tt"
if (operation.Paginators.MoreResults != null)
{
#line default
#line hidden
this.Write(" response.");
#line 88 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\PaginatorTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(operation.Paginators.MoreResults.PropertyName));
#line default
#line hidden
this.Write(" = false;\r\n");
#line 89 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\PaginatorTests.tt"
}
else if (operation.Paginators.InputTokens[0].IsListOrDict)
{
#line default
#line hidden
this.Write(" response.");
#line 94 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\PaginatorTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(operation.Paginators.OutputTokens[0].PropertyName));
#line default
#line hidden
this.Write(".Clear();\r\n");
#line 95 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\PaginatorTests.tt"
}
else
{
#line default
#line hidden
this.Write(" response.");
#line 100 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\PaginatorTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(operation.Paginators.OutputTokens[0].PropertyName));
#line default
#line hidden
this.Write(" = null;\r\n");
#line 101 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\PaginatorTests.tt"
}
#line default
#line hidden
this.Write("\r\n _mockClient.Setup(x => x.");
#line 105 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\PaginatorTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(operation.Name));
#line default
#line hidden
this.Write("(request)).Returns(response);\r\n var paginator = _mockClient.Object.Pag" +
"inators.");
#line 106 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\PaginatorTests.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(operation.Name));
#line default
#line hidden
this.Write("(request);\r\n\r\n // Should work the first time\r\n paginator.Re" +
"sponses.ToList();\r\n\r\n // Second time should throw an exception\r\n " +
" paginator.Responses.ToList();\r\n }\r\n\r\n");
#line 115 "C:\projects\aws\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\TestFiles\PaginatorTests.tt"
}
}
#line default
#line hidden
this.Write(" }\r\n}");
return this.GenerationEnvironment.ToString();
}
}
#line default
#line hidden
}