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

Remove Parameters-TypeSpec #4922

Closed
wants to merge 12 commits into from
Closed
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 @@ -51,6 +51,7 @@
"parameters/collection-format",
"parameters/spread",
"parameters/body-optionality",
"parameters/query-optionality",
"client/naming",
"client/structure/default",
"client/structure/multi-client",
Expand Down
8 changes: 4 additions & 4 deletions src/AutoRest.CSharp/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -536,10 +536,6 @@
"commandName": "Project",
"commandLineArgs": "--standalone $(SolutionDir)\\test\\TestProjects\\Parameters-LowLevel\\src\\Generated -n"
},
"Parameters-TypeSpec": {
"commandName": "Project",
"commandLineArgs": "--standalone $(SolutionDir)\\test\\TestProjects\\Parameters-TypeSpec\\src\\Generated -n"
},
"ParameterSequence-LowLevel": {
"commandName": "Project",
"commandLineArgs": "--standalone $(SolutionDir)\\test\\TestProjects\\ParameterSequence-LowLevel\\src\\Generated -n"
Expand Down Expand Up @@ -808,6 +804,10 @@
"commandName": "Project",
"commandLineArgs": "--standalone $(SolutionDir)\\test\\CadlRanchProjects\\parameters\\collection-format\\src\\Generated -n"
},
"typespec-parameters/query-optionality": {
"commandName": "Project",
"commandLineArgs": "--standalone $(SolutionDir)\\test\\CadlRanchProjects\\parameters\\query-optionality\\src\\Generated -n"
},
"typespec-parameters/spread": {
"commandName": "Project",
"commandLineArgs": "--standalone $(SolutionDir)\\test\\CadlRanchProjects\\parameters\\spread\\src\\Generated -n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System;
using System.Linq;
using Parameters_LowLevel;
using ParametersCadl;
using NUnit.Framework;
using Azure.Core;
using Azure;
Expand All @@ -18,11 +17,6 @@ public class ParameterSequenceTests
[TestCase(typeof(ParametersLowlevelClient), "OptionalPathParameters", new Type[] { typeof(int), typeof(string), typeof(int), typeof(RequestContext) }, new string[] { "id", "name", "skip", "context" }, new bool[] { false, false, false, true })]
[TestCase(typeof(ParametersLowlevelClient), "OptionalPathParametersWithMixedSequence", new Type[] { typeof(int), typeof(string), typeof(int), typeof(RequestContext) }, new string[] { "id", "name", "skip", "context" }, new bool[] { false, false, false, true })]
[TestCase(typeof(ParametersLowlevelClient), "OptionalPathBodyParametersWithMixedSequence", new Type[] { typeof(int), typeof(string), typeof(int), typeof(int), typeof(RequestContent), typeof(int), typeof(RequestContext) }, new string[] { "id", "name", "skip", "max", "content", "top", "context" }, new bool[] { false, false, false, false, false, true, true })]
[TestCase(typeof(ParametersCadlClient), "GetParameterOrdersClient", new Type[] { typeof(string) }, new string[] { "apiVersion" }, new bool[] { true })]
[TestCase(typeof(ParameterOrders), "Operation", new Type[] { typeof(int), typeof(int), typeof(CancellationToken) }, new string[] { "start", "end", "cancellationToken" }, new bool[] { false, true, true })]
[TestCase(typeof(ParameterOrders), "Operation", new Type[] { typeof(int), typeof(int), typeof(RequestContext) }, new string[] { "start", "end", "context" }, new bool[] { false, false, false })]
[TestCase(typeof(ParameterOrders), "Operation2", new Type[] { typeof(int), typeof(int), typeof(CancellationToken) }, new string[] { "end", "start", "cancellationToken" }, new bool[] { false, true, true })]
[TestCase(typeof(ParameterOrders), "Operation2", new Type[] { typeof(int), typeof(int), typeof(RequestContext) }, new string[] { "end", "start", "context" }, new bool[] { false, false, false })]
public void OptionalParameterAtEnd(Type type, string methodName, Type[] types, string[] parameterNames, bool[] isOptional)
{
var method = type.GetMethod(methodName, types);
Expand Down
25 changes: 25 additions & 0 deletions test/CadlRanchProjects.Tests/parameter-query-optionality.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System.Threading.Tasks;
using AutoRest.TestServer.Tests.Infrastructure;
using Azure;
using NUnit.Framework;
using Parameters.QueryOptionality;

namespace CadlRanchProjects.Tests
{
public class ParametersQueryOptionalityTests : CadlRanchTestBase
{
[Test]
public Task Parameters_QueryOptionality_fromrequired() => Test(async (host) =>
{
var response = await new QueryOptionalityClient(host, null).FromRequiredAsync("required");
Assert.AreEqual(204, response.Status);
});

[Test]
public Task Parameters_QueryOptionality_fromoptional() => Test(async (host) =>
{
var response = await new QueryOptionalityClient(host, null).FromOptionalAsync("required");
Assert.AreEqual(204, response.Status);
});
}
}

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
Expand Up @@ -2,9 +2,9 @@ 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}") = "ParametersCadl", "src\ParametersCadl.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Parameters.QueryOptionality", "src\Parameters.QueryOptionality.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ParametersCadl.Tests", "tests\ParametersCadl.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Parameters.QueryOptionality.Tests", "tests\Parameters.QueryOptionality.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<doc>
<members>
<member name="FromRequiredAsync(string,string,RequestContext)">
<example>
This sample shows how to call FromRequiredAsync.
<code><![CDATA[
QueryOptionalityClient client = new QueryOptionalityClient();

Response response = await client.FromRequiredAsync("<start>");

Console.WriteLine(response.Status);
]]></code>
This sample shows how to call FromRequiredAsync with all parameters.
<code><![CDATA[
QueryOptionalityClient client = new QueryOptionalityClient();

Response response = await client.FromRequiredAsync("<start>", end: "<end>");

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

Response response = client.FromRequired("<start>");

Console.WriteLine(response.Status);
]]></code>
This sample shows how to call FromRequired with all parameters.
<code><![CDATA[
QueryOptionalityClient client = new QueryOptionalityClient();

Response response = client.FromRequired("<start>", end: "<end>");

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

Response response = await client.FromOptionalAsync("<end>");

Console.WriteLine(response.Status);
]]></code>
This sample shows how to call FromOptionalAsync with all parameters.
<code><![CDATA[
QueryOptionalityClient client = new QueryOptionalityClient();

Response response = await client.FromOptionalAsync("<end>", start: "<start>");

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

Response response = client.FromOptional("<end>");

Console.WriteLine(response.Status);
]]></code>
This sample shows how to call FromOptional with all parameters.
<code><![CDATA[
QueryOptionalityClient client = new QueryOptionalityClient();

Response response = client.FromOptional("<end>", start: "<start>");

Console.WriteLine(response.Status);
]]></code></example>
</member>
</members>
</doc>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using System.Collections;
using System.Collections.Generic;

namespace ParametersCadl
namespace Parameters.QueryOptionality
{
internal static class Argument
{
Expand Down

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

Loading
Loading