Skip to content

Commit 98b9107

Browse files
Adopt server spector scenarios (Azure#50473)
* Adopt server spector scenarios * regen
1 parent c7dcb11 commit 98b9107

File tree

24 files changed

+1167
-2
lines changed

24 files changed

+1167
-2
lines changed

eng/packages/http-client-csharp/eng/scripts/Generate.ps1

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ function IsSpecDir {
5252

5353
$failingSpecs = @(
5454
Join-Path 'http' 'payload' 'xml'
55-
Join-Path 'http' 'server' 'path' 'multiple'
56-
Join-Path 'http' 'server' 'versions' 'versioned'
5755
Join-Path 'http' 'versioning' 'added'
5856
Join-Path 'http' 'versioning' 'madeOptional'
5957
Join-Path 'http' 'versioning' 'removed'

eng/packages/http-client-csharp/generator/Azure.Generator/src/Properties/launchSettings.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@
145145
"commandName": "Executable",
146146
"executablePath": "dotnet"
147147
},
148+
"http-server-path-multiple": {
149+
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/server/path/multiple -g AzureStubGenerator",
150+
"commandName": "Executable",
151+
"executablePath": "dotnet"
152+
},
148153
"http-server-path-single": {
149154
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/server/path/single -g AzureStubGenerator",
150155
"commandName": "Executable",
@@ -155,6 +160,11 @@
155160
"commandName": "Executable",
156161
"executablePath": "dotnet"
157162
},
163+
"http-server-versions-versioned": {
164+
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/server/versions/versioned -g AzureStubGenerator",
165+
"commandName": "Executable",
166+
"executablePath": "dotnet"
167+
},
158168
"http-special-headers-conditional-request": {
159169
"commandLineArgs": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.dll $(SolutionDir)/TestProjects/Spector/http/special-headers/conditional-request -g AzureStubGenerator",
160170
"commandName": "Executable",
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
using NUnit.Framework;
5+
using Server.Endpoint.NotDefined;
6+
using System.Threading.Tasks;
7+
8+
namespace TestProjects.Spector.Tests.Http.Server.Endpoint.NotDefined
9+
{
10+
public class NotDefinedTests : SpectorTestBase
11+
{
12+
[SpectorTest]
13+
public Task Valid() => Test(async (host) =>
14+
{
15+
var response = await new NotDefinedClient(host, null).ValidAsync();
16+
Assert.AreEqual(200, response.Status);
17+
});
18+
}
19+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
using System.Threading.Tasks;
5+
using NUnit.Framework;
6+
using Server.Path.Multiple;
7+
8+
namespace TestProjects.Spector.Tests.Http.Server.Path.Multiple
9+
{
10+
internal class MultipleTests : SpectorTestBase
11+
{
12+
[SpectorTest]
13+
public Task NoOperationParams() => Test(async (host) =>
14+
{
15+
var result = await new MultipleClient(host, null).NoOperationParamsAsync();
16+
Assert.AreEqual(204, result.Status);
17+
});
18+
19+
[SpectorTest]
20+
public Task WithOperationPathParam() => Test(async (host) =>
21+
{
22+
var result = await new MultipleClient(host, null).WithOperationPathParamAsync("test");
23+
Assert.AreEqual(204, result.Status);
24+
});
25+
}
26+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
using NUnit.Framework;
5+
using Server.Path.Single;
6+
using System.Threading.Tasks;
7+
8+
namespace TestProjects.Spector.Tests.Http.Server.Path.Single
9+
{
10+
public class SingleTests : SpectorTestBase
11+
{
12+
[SpectorTest]
13+
public Task MyOp() => Test(async (host) =>
14+
{
15+
var result = await new SingleClient(host, null).MyOpAsync();
16+
Assert.AreEqual(200, result.Status);
17+
});
18+
}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
using System.Threading.Tasks;
5+
using NUnit.Framework;
6+
using Server.Versions.NotVersioned;
7+
8+
namespace TestProjects.Spector.Tests.Http.Server.Versions.NotVersioned
9+
{
10+
public class NotVersionedTests : SpectorTestBase
11+
{
12+
[SpectorTest]
13+
public Task WithoutApiVersion() => Test(async (host) =>
14+
{
15+
var response = await new NotVersionedClient(host, null).WithoutApiVersionAsync();
16+
Assert.AreEqual(200, response.Status);
17+
});
18+
19+
[SpectorTest]
20+
public Task WithQueryApiVersion() => Test(async (host) =>
21+
{
22+
var response = await new NotVersionedClient(host, null).WithQueryApiVersionAsync("v1.0");
23+
Assert.AreEqual(200, response.Status);
24+
});
25+
26+
[SpectorTest]
27+
public Task WithPathApiVersion() => Test(async (host) =>
28+
{
29+
var response = await new NotVersionedClient(host, null).WithPathApiVersionAsync("v1.0");
30+
Assert.AreEqual(200, response.Status);
31+
});
32+
}
33+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
using System.Threading.Tasks;
5+
using NUnit.Framework;
6+
using Server.Versions.Versioned;
7+
8+
namespace TestProjects.Spector.Tests.Http.Server.Versions.Versioned
9+
{
10+
public class VersionedTests : SpectorTestBase
11+
{
12+
[SpectorTest]
13+
public Task WithoutApiVersion() => Test(async (host) =>
14+
{
15+
var response = await new VersionedClient(host, null).WithoutApiVersionAsync();
16+
Assert.AreEqual(200, response.Status);
17+
});
18+
19+
[SpectorTest]
20+
public Task WithQueryApiVersion() => Test(async (host) =>
21+
{
22+
var response = await new VersionedClient(host, null).WithQueryApiVersionAsync();
23+
Assert.AreEqual(200, response.Status);
24+
});
25+
26+
[SpectorTest]
27+
public Task WithPathApiVersion() => Test(async (host) =>
28+
{
29+
var response = await new VersionedClient(host, null).WithPathApiVersionAsync();
30+
Assert.AreEqual(200, response.Status);
31+
});
32+
33+
[SpectorTest]
34+
public Task WithQueryOldApiVersion() => Test(async (host) =>
35+
{
36+
var options = new VersionedClientOptions(VersionedClientOptions.ServiceVersion.V2021_01_01_Preview);
37+
var response = await new VersionedClient(host, options).WithQueryOldApiVersionAsync();
38+
Assert.AreEqual(200, response.Status);
39+
});
40+
}
41+
}

eng/packages/http-client-csharp/generator/TestProjects/Spector.Tests/TestProjects.Spector.Tests.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@
4646
<ProjectReference Include="..\Spector\http\routes\src\Routes.csproj" />
4747
<ProjectReference Include="..\Spector\http\serialization\encoded-name\json\src\Serialization.EncodedName.Json.csproj" />
4848
<ProjectReference Include="..\Spector\http\server\endpoint\not-defined\src\Server.Endpoint.NotDefined.csproj" />
49+
<ProjectReference Include="..\Spector\http\server\path\multiple\src\Server.Path.Multiple.csproj" />
50+
<ProjectReference Include="..\Spector\http\server\path\single\src\Server.Path.Single.csproj" />
4951
<ProjectReference Include="..\Spector\http\server\versions\not-versioned\src\Server.Versions.NotVersioned.csproj" />
52+
<ProjectReference Include="..\Spector\http\server\versions\versioned\src\Server.Versions.Versioned.csproj" />
5053
<ProjectReference Include="..\Spector\http\special-headers\conditional-request\src\SpecialHeaders.ConditionalRequest.csproj" />
5154
<ProjectReference Include="..\Spector\http\special-headers\repeatability\src\SpecialHeaders.Repeatability.csproj" />
5255
<ProjectReference Include="..\Spector\http\special-words\src\SpecialWords.csproj" />
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"package-name": "Server.Path.Multiple",
3+
"license": {
4+
"name": "MIT License",
5+
"company": "Microsoft Corporation",
6+
"link": "https://mit-license.org",
7+
"header": "Copyright (c) Microsoft Corporation. All rights reserved.\nLicensed under the MIT License.",
8+
"description": "Copyright (c) Microsoft Corporation\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the “Software”), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE."
9+
}
10+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
Microsoft Visual Studio Solution File, Format Version 12.00
2+
# Visual Studio Version 16
3+
VisualStudioVersion = 16.0.29709.97
4+
MinimumVisualStudioVersion = 10.0.40219.1
5+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Server.Path.Multiple", "src\Server.Path.Multiple.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}"
6+
EndProject
7+
Global
8+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
9+
Debug|Any CPU = Debug|Any CPU
10+
Release|Any CPU = Release|Any CPU
11+
EndGlobalSection
12+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
13+
{B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
14+
{B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
15+
{B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
16+
{B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU
17+
{8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
18+
{8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU
19+
{8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU
20+
{8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU
21+
{A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
22+
{A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU
23+
{A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU
24+
{A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU
25+
{FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
26+
{FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU
27+
{FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU
28+
{FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU
29+
{85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
30+
{85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
31+
{85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
32+
{85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU
33+
{28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
34+
{28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU
35+
{28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU
36+
{28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU
37+
{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
38+
{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU
39+
{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU
40+
{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU
41+
EndGlobalSection
42+
GlobalSection(SolutionProperties) = preSolution
43+
HideSolutionNode = FALSE
44+
EndGlobalSection
45+
GlobalSection(ExtensibilityGlobals) = postSolution
46+
SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE}
47+
EndGlobalSection
48+
EndGlobal

0 commit comments

Comments
 (0)