Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TypeModelGeneric Test #4950

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions eng/testProjects.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"type/model/usage",
"type/model/empty",
"type/model/flatten",
"type/model/generic",
"type/model/inheritance/single-discriminator",
"type/model/inheritance/not-discriminated",
"type/model/inheritance/enum-discriminator",
Expand Down
4 changes: 4 additions & 0 deletions src/AutoRest.CSharp/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,10 @@
"commandName": "Project",
"commandLineArgs": "--standalone $(SolutionDir)\\test\\CadlRanchProjects\\type\\model\\flatten\\src\\Generated -n"
},
"typespec-type/model/generic": {
"commandName": "Project",
"commandLineArgs": "--standalone $(SolutionDir)\\test\\CadlRanchProjects\\type\\model\\generic\\src\\Generated -n"
},
"typespec-type/model/inheritance/enum-discriminator": {
"commandName": "Project",
"commandLineArgs": "--standalone $(SolutionDir)\\test\\CadlRanchProjects\\type\\model\\inheritance\\enum-discriminator\\src\\Generated -n"
Expand Down
23 changes: 23 additions & 0 deletions test/CadlRanchProjects.Tests/type-model-generic.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System.Threading.Tasks;
using AutoRest.TestServer.Tests.Infrastructure;
using Azure;
using NUnit.Framework;
using _Type.Model.Generic.Models;
using _Type.Model.Generic;
using System.Collections.Generic;

namespace CadlRanchProjects.Tests
{
public class TypeModelGenericTests : CadlRanchTestBase
{
[Test]
public Task Type_Model_Generic_genericType() => Test(async (host) =>
{
var values = new List<int> { 1234 };
var value = 1234;
var input = new Int32Type(values, value);
Response response = await new GenericClient(host, null).GenericTypeAsync(input);
Assert.AreEqual(204, response.Status);
});
}
}
11 changes: 11 additions & 0 deletions test/CadlRanchProjects/type/model/generic/Configuration.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29709.97
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_Type.Model.Generic", "src\_Type.Model.Generic.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_Type.Model.Generic.Tests", "tests\_Type.Model.Generic.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU
{8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU
{A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU
{FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU
{85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU
{28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU
{28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU
{28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU
{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="utf-8"?>
<doc>
<members>
<member name="GenericTypeAsync(Int32Type,CancellationToken)">
<example>
This sample shows how to call GenericTypeAsync.
<code><![CDATA[
GenericClient client = new GenericClient();

Int32Type input = new Int32Type(new int[] { 1234 }, 1234);
Response response = await client.GenericTypeAsync(input);
]]></code>
This sample shows how to call GenericTypeAsync with all parameters.
<code><![CDATA[
GenericClient client = new GenericClient();

Int32Type input = new Int32Type(new int[] { 1234 }, 1234);
Response response = await client.GenericTypeAsync(input);
]]></code></example>
</member>
<member name="GenericType(Int32Type,CancellationToken)">
<example>
This sample shows how to call GenericType.
<code><![CDATA[
GenericClient client = new GenericClient();

Int32Type input = new Int32Type(new int[] { 1234 }, 1234);
Response response = client.GenericType(input);
]]></code>
This sample shows how to call GenericType with all parameters.
<code><![CDATA[
GenericClient client = new GenericClient();

Int32Type input = new Int32Type(new int[] { 1234 }, 1234);
Response response = client.GenericType(input);
]]></code></example>
</member>
<member name="GenericTypeAsync(RequestContent,RequestContext)">
<example>
This sample shows how to call GenericTypeAsync.
<code><![CDATA[
GenericClient client = new GenericClient();

using RequestContent content = RequestContent.Create(new
{
kind = "Int32Values",
values = new object[]
{
1234
},
value = 1234,
});
Response response = await client.GenericTypeAsync(content);

Console.WriteLine(response.Status);
]]></code>
This sample shows how to call GenericTypeAsync with all request content.
<code><![CDATA[
GenericClient client = new GenericClient();

using RequestContent content = RequestContent.Create(new
{
kind = "Int32Values",
values = new object[]
{
1234
},
value = 1234,
});
Response response = await client.GenericTypeAsync(content);

Console.WriteLine(response.Status);
]]></code></example>
</member>
<member name="GenericType(RequestContent,RequestContext)">
<example>
This sample shows how to call GenericType.
<code><![CDATA[
GenericClient client = new GenericClient();

using RequestContent content = RequestContent.Create(new
{
kind = "Int32Values",
values = new object[]
{
1234
},
value = 1234,
});
Response response = client.GenericType(content);

Console.WriteLine(response.Status);
]]></code>
This sample shows how to call GenericType with all request content.
<code><![CDATA[
GenericClient client = new GenericClient();

using RequestContent content = RequestContent.Create(new
{
kind = "Int32Values",
values = new object[]
{
1234
},
value = 1234,
});
Response response = client.GenericType(content);

Console.WriteLine(response.Status);
]]></code></example>
</member>
</members>
</doc>
Loading
Loading