-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #3980
- Loading branch information
Showing
11 changed files
with
654 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...nt-csharp/generator/TestProjects/CadlRanch.Tests/Http/Payload/MediaType/MediaTypeTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System.Threading.Tasks; | ||
using NUnit.Framework; | ||
using Payload.MediaType; | ||
|
||
namespace TestProjects.CadlRanch.Tests.Http.Payload.MediaType | ||
{ | ||
public class MediaTypeTests : CadlRanchTestBase | ||
{ | ||
[CadlRanchTest] | ||
public Task SendAsText() => Test(async (host) => | ||
{ | ||
var response1 = await new MediaTypeClient(host, null).GetStringBodyClient().SendAsTextAsync("{cat}"); | ||
Assert.AreEqual(200, response1.GetRawResponse().Status); | ||
}); | ||
|
||
[CadlRanchTest] | ||
public Task GetAsText() => Test(async (host) => | ||
{ | ||
var response2 = await new MediaTypeClient(host, null).GetStringBodyClient().GetAsTextAsync(); | ||
Assert.AreEqual("{cat}", response2.Value); | ||
}); | ||
|
||
[CadlRanchTest] | ||
[Ignore("https://github.com/microsoft/typespec/issues/4208")] | ||
public Task SendAsJson() => Test(async (host) => | ||
{ | ||
var response3 = await new MediaTypeClient(host, null).GetStringBodyClient().SendAsJsonAsync("foo"); | ||
Assert.AreEqual(200, response3.GetRawResponse().Status); | ||
}); | ||
|
||
[CadlRanchTest] | ||
[Ignore("https://github.com/microsoft/typespec/issues/4208")] | ||
public Task GetAsJson() => Test(async (host) => | ||
{ | ||
var response4 = await new MediaTypeClient(host, null).GetStringBodyClient().GetAsJsonAsync(); | ||
Assert.AreEqual("foo", response4.Value); | ||
}); | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...client-csharp/generator/TestProjects/CadlRanch/http/payload/media-type/Configuration.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"output-folder": ".", | ||
"namespace": "Payload.MediaType", | ||
"library-name": "Payload.MediaType", | ||
"use-model-reader-writer": true | ||
} |
48 changes: 48 additions & 0 deletions
48
...ent-csharp/generator/TestProjects/CadlRanch/http/payload/media-type/Payload.MediaType.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
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}") = "Payload.MediaType", "src\Payload.MediaType.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" | ||
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 |
20 changes: 20 additions & 0 deletions
20
...generator/TestProjects/CadlRanch/http/payload/media-type/src/Generated/MediaTypeClient.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// <auto-generated/> | ||
|
||
#nullable disable | ||
|
||
using System; | ||
using System.ClientModel.Primitives; | ||
|
||
namespace Payload.MediaType | ||
{ | ||
public partial class MediaTypeClient | ||
{ | ||
public MediaTypeClient() : this(new Uri("http://localhost:3000"), new MediaTypeClientOptions()) => throw null; | ||
|
||
public MediaTypeClient(Uri endpoint, MediaTypeClientOptions options) => throw null; | ||
|
||
public ClientPipeline Pipeline => throw null; | ||
|
||
public virtual StringBody GetStringBodyClient() => throw null; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...or/TestProjects/CadlRanch/http/payload/media-type/src/Generated/MediaTypeClientOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// <auto-generated/> | ||
|
||
#nullable disable | ||
|
||
using System.ClientModel.Primitives; | ||
|
||
namespace Payload.MediaType | ||
{ | ||
public partial class MediaTypeClientOptions : ClientPipelineOptions | ||
{ | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
...harp/generator/TestProjects/CadlRanch/http/payload/media-type/src/Generated/StringBody.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// <auto-generated/> | ||
|
||
#nullable disable | ||
|
||
using System.ClientModel; | ||
using System.ClientModel.Primitives; | ||
using System.Threading.Tasks; | ||
|
||
namespace Payload.MediaType | ||
{ | ||
public partial class StringBody | ||
{ | ||
protected StringBody() => throw null; | ||
|
||
public ClientPipeline Pipeline => throw null; | ||
|
||
public virtual ClientResult SendAsText(BinaryContent content, RequestOptions options) => throw null; | ||
|
||
public virtual Task<ClientResult> SendAsTextAsync(BinaryContent content, RequestOptions options) => throw null; | ||
|
||
public virtual ClientResult SendAsText(string text) => throw null; | ||
|
||
public virtual Task<ClientResult> SendAsTextAsync(string text) => throw null; | ||
|
||
public virtual ClientResult GetAsText(RequestOptions options) => throw null; | ||
|
||
public virtual Task<ClientResult> GetAsTextAsync(RequestOptions options) => throw null; | ||
|
||
public virtual ClientResult<string> GetAsText() => throw null; | ||
|
||
public virtual Task<ClientResult<string>> GetAsTextAsync() => throw null; | ||
|
||
public virtual ClientResult SendAsJson(BinaryContent content, RequestOptions options) => throw null; | ||
|
||
public virtual Task<ClientResult> SendAsJsonAsync(BinaryContent content, RequestOptions options) => throw null; | ||
|
||
public virtual ClientResult SendAsJson(string text) => throw null; | ||
|
||
public virtual Task<ClientResult> SendAsJsonAsync(string text) => throw null; | ||
|
||
public virtual ClientResult GetAsJson(RequestOptions options) => throw null; | ||
|
||
public virtual Task<ClientResult> GetAsJsonAsync(RequestOptions options) => throw null; | ||
|
||
public virtual ClientResult<string> GetAsJson() => throw null; | ||
|
||
public virtual Task<ClientResult<string>> GetAsJsonAsync() => throw null; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...arp/generator/TestProjects/CadlRanch/http/payload/media-type/src/Payload.MediaType.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<Description>This is the Payload.MediaType client library for developing .NET applications with rich experience.</Description> | ||
<AssemblyTitle>SDK Code Generation Payload.MediaType</AssemblyTitle> | ||
<Version>1.0.0-beta.1</Version> | ||
<PackageTags>Payload.MediaType</PackageTags> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
<LangVersion>latest</LangVersion> | ||
<GenerateDocumentationFile>true</GenerateDocumentationFile> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="System.ClientModel" Version="1.1.0-beta.4" /> | ||
<PackageReference Include="System.Text.Json" Version="8.0.4" /> | ||
</ItemGroup> | ||
</Project> |
Oops, something went wrong.