-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adopt http\resiliency\srv-driven
- Loading branch information
1 parent
13d2064
commit eb57b4f
Showing
19 changed files
with
1,166 additions
and
3 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
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
77 changes: 77 additions & 0 deletions
77
...arp/generator/TestProjects/CadlRanch.Tests/Http/Resiliency/SrvDriven/SrvDrivenTests.V1.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,77 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using NUnit.Framework; | ||
using Resiliency.ServiceDriven.V1; | ||
using System.Threading.Tasks; | ||
|
||
namespace TestProjects.CadlRanch.Tests.Http.Resiliency.SrvDriven | ||
{ | ||
/// <summary> | ||
/// Contains tests for the service-driven resiliency V1 client. | ||
/// </summary> | ||
public partial class SrvDrivenTests : CadlRanchTestBase | ||
{ | ||
// This test validates the v1 client behavior when both the service deployment and api version are set to V1. | ||
[CadlRanchTest] | ||
public Task AddOptionalParamFromNone_V1Client_V1Service_WithApiVersionV1() => Test(async (host) => | ||
{ | ||
var options = new ResiliencyServiceDrivenClientOptions(ResiliencyServiceDrivenClientOptions.ServiceVersion.V1); | ||
var client = new ResiliencyServiceDrivenClient(host, ServiceDeploymentV1, options); | ||
var response = await client.FromNoneAsync(); | ||
|
||
Assert.AreEqual(204, response.GetRawResponse().Status); | ||
}); | ||
|
||
// This test validates the v1 client behavior when the service deployment is set to V2 and the api version is set to V1. | ||
[CadlRanchTest] | ||
public Task AddOptionalParamFromNone_V1Client_V2Service_WithApiVersionV1() => Test(async (host) => | ||
{ | ||
var options = new ResiliencyServiceDrivenClientOptions(ResiliencyServiceDrivenClientOptions.ServiceVersion.V1); | ||
var client = new ResiliencyServiceDrivenClient(host, ServiceDeploymentV2, options); | ||
var response = await client.FromNoneAsync(); | ||
|
||
Assert.AreEqual(204, response.GetRawResponse().Status); | ||
}); | ||
|
||
[CadlRanchTest] | ||
public Task AddOptionalParamFromOneOptional_V1Client_V1Service_WithApiVersionV1() => Test(async (host) => | ||
{ | ||
var options = new ResiliencyServiceDrivenClientOptions(ResiliencyServiceDrivenClientOptions.ServiceVersion.V1); | ||
var client = new ResiliencyServiceDrivenClient(host, ServiceDeploymentV1, options); | ||
var response = await client.FromOneOptionalAsync("optional"); | ||
|
||
Assert.AreEqual(204, response.GetRawResponse().Status); | ||
}); | ||
|
||
[CadlRanchTest] | ||
public Task AddOptionalParamFromOneOptional_V1Client_V2Service_WithApiVersionV1() => Test(async (host) => | ||
{ | ||
var options = new ResiliencyServiceDrivenClientOptions(ResiliencyServiceDrivenClientOptions.ServiceVersion.V1); | ||
var client = new ResiliencyServiceDrivenClient(host, ServiceDeploymentV2, options); | ||
var response = await client.FromOneOptionalAsync("optional"); | ||
|
||
Assert.AreEqual(204, response.GetRawResponse().Status); | ||
}); | ||
|
||
[CadlRanchTest] | ||
public Task AddOptionalParamFromOneRequired_V1Client_V1Service_WithApiVersionV1() => Test(async (host) => | ||
{ | ||
var options = new ResiliencyServiceDrivenClientOptions(ResiliencyServiceDrivenClientOptions.ServiceVersion.V1); | ||
var client = new ResiliencyServiceDrivenClient(host, ServiceDeploymentV1, options); | ||
var response = await client.FromOneRequiredAsync("required"); | ||
|
||
Assert.AreEqual(204, response.GetRawResponse().Status); | ||
}); | ||
|
||
[CadlRanchTest] | ||
public Task AddOptionalParamFromOneRequired_V1Client_V2Service_WithApiVersionV1() => Test(async (host) => | ||
{ | ||
var options = new ResiliencyServiceDrivenClientOptions(ResiliencyServiceDrivenClientOptions.ServiceVersion.V1); | ||
var client = new ResiliencyServiceDrivenClient(host, ServiceDeploymentV2, options); | ||
var response = await client.FromOneRequiredAsync("required"); | ||
|
||
Assert.AreEqual(204, response.GetRawResponse().Status); | ||
}); | ||
} | ||
} |
86 changes: 86 additions & 0 deletions
86
...csharp/generator/TestProjects/CadlRanch.Tests/Http/Resiliency/SrvDriven/SrvDrivenTests.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,86 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using NUnit.Framework; | ||
using System.Threading.Tasks; | ||
using Resiliency.ServiceDriven; | ||
|
||
namespace TestProjects.CadlRanch.Tests.Http.Resiliency.SrvDriven | ||
{ | ||
public partial class SrvDrivenTests : CadlRanchTestBase | ||
{ | ||
private const string ServiceDeploymentV1 = "v1"; | ||
private const string ServiceDeploymentV2 = "v2"; | ||
|
||
[CadlRanchTest] | ||
public Task AddOperation() => Test(async (host) => | ||
{ | ||
var client = new ResiliencyServiceDrivenClient(host, ServiceDeploymentV2); | ||
var response = await client.AddOperationAsync(); | ||
|
||
Assert.AreEqual(204, response.GetRawResponse().Status); | ||
}); | ||
|
||
// This test validates the "new" client behavior when the api version is set to V1. | ||
[CadlRanchTest] | ||
public Task AddOptionalParamFromNone_WithApiVersionV1() => Test(async (host) => | ||
{ | ||
var options = new ResiliencyServiceDrivenClientOptions(ResiliencyServiceDrivenClientOptions.ServiceVersion.V1); | ||
var client = new ResiliencyServiceDrivenClient(host, ServiceDeploymentV2, options); | ||
var response = await client.FromNoneAsync(); | ||
|
||
Assert.AreEqual(204, response.GetRawResponse().Status); | ||
}); | ||
|
||
// This test validates the "new" client behavior when the api version is set to V2. | ||
[CadlRanchTest] | ||
public Task AddOptionalParamFromNone_WithApiVersionV2() => Test(async (host) => | ||
{ | ||
var options = new ResiliencyServiceDrivenClientOptions(ResiliencyServiceDrivenClientOptions.ServiceVersion.V2); | ||
var client = new ResiliencyServiceDrivenClient(host, ServiceDeploymentV2, options); | ||
var response = await client.FromNoneAsync("new"); | ||
|
||
Assert.AreEqual(204, response.GetRawResponse().Status); | ||
}); | ||
|
||
[CadlRanchTest] | ||
public Task AddOptionalParamFromOneOptional_WithApiVersionV1() => Test(async (host) => | ||
{ | ||
var options = new ResiliencyServiceDrivenClientOptions(ResiliencyServiceDrivenClientOptions.ServiceVersion.V1); | ||
var client = new ResiliencyServiceDrivenClient(host, ServiceDeploymentV2, options); | ||
var response = await client.FromOneOptionalAsync("optional"); | ||
|
||
Assert.AreEqual(204, response.GetRawResponse().Status); | ||
}); | ||
|
||
[CadlRanchTest] | ||
public Task AddOptionalParamFromOneOptional_WithApiVersionV2() => Test(async (host) => | ||
{ | ||
var options = new ResiliencyServiceDrivenClientOptions(ResiliencyServiceDrivenClientOptions.ServiceVersion.V2); | ||
var client = new ResiliencyServiceDrivenClient(host, ServiceDeploymentV2, options); | ||
var response = await client.FromOneOptionalAsync("optional", "new"); | ||
|
||
Assert.AreEqual(204, response.GetRawResponse().Status); | ||
}); | ||
|
||
[CadlRanchTest] | ||
public Task AddOptionalParamFromOneRequired_WithApiVersionV1() => Test(async (host) => | ||
{ | ||
var options = new ResiliencyServiceDrivenClientOptions(ResiliencyServiceDrivenClientOptions.ServiceVersion.V1); | ||
var client = new ResiliencyServiceDrivenClient(host, ServiceDeploymentV2, options); | ||
var response = await client.FromOneRequiredAsync("required"); | ||
|
||
Assert.AreEqual(204, response.GetRawResponse().Status); | ||
}); | ||
|
||
[CadlRanchTest] | ||
public Task AddOptionalParamFromOneRequired_WithApiVersionV2() => Test(async (host) => | ||
{ | ||
var options = new ResiliencyServiceDrivenClientOptions(ResiliencyServiceDrivenClientOptions.ServiceVersion.V2); | ||
var client = new ResiliencyServiceDrivenClient(host, ServiceDeploymentV2, options); | ||
var response = await client.FromOneRequiredAsync("required", "new"); | ||
|
||
Assert.AreEqual(204, response.GetRawResponse().Status); | ||
}); | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...ent-csharp/generator/TestProjects/CadlRanch/http/resiliency/srv-driven/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": "Resiliency.ServiceDriven", | ||
"library-name": "Resiliency.ServiceDriven", | ||
"use-model-reader-writer": true | ||
} |
48 changes: 48 additions & 0 deletions
48
.../generator/TestProjects/CadlRanch/http/resiliency/srv-driven/Resiliency.ServiceDriven.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}") = "Resiliency.ServiceDriven", "src\Resiliency.ServiceDriven.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 |
Oops, something went wrong.