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

change the attributes in generated cases #5150

Merged
merged 6 commits into from
Nov 12, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ private void WriteSample(Sample sample)
}

// write the attributes
_writer.Line($"// {sample.Name}");
ArcturusZhang marked this conversation as resolved.
Show resolved Hide resolved
_writer.Line($"[NUnit.Framework.Test]");
_writer.Line($"[NUnit.Framework.Ignore(\"Only verifying that the sample builds\")]");
_writer.UseNamespace("NUnit.Framework");
_writer.Line($"[Test]");
_writer.Line($"[Ignore(\"Only validating compilation of examples\")]");
using (_writer.WriteMethodDeclaration(signature))
{
WriteSampleSteps(sample);
Expand Down Expand Up @@ -107,15 +107,15 @@ private void WriteResultHandling(CodeWriterVariableDeclaration? result, bool new

if (result == null)
{
_writer.Line($"{typeof(Console)}.WriteLine($\"Succeeded\");");
_writer.Line($"{typeof(Console)}.WriteLine(\"Succeeded\");");
}
else
{
if (result.Type.IsNullable)
{
using (_writer.Scope($"if({result.Declaration} == null)"))
{
_writer.Line($"{typeof(Console)}.WriteLine($\"Succeeded with null as result\");");
_writer.Line($"{typeof(Console)}.WriteLine(\"Succeeded with null as result\");");
}
using (_writer.Scope($"else"))
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"parameters": {
"api-version": "2021-04-01",
"template": {
"$schema": "http://schemas.management.azure.com/deploymentTemplate?api-version=2014-04-01-preview",
"contentVersion": "1.0.0.0",
"parameters": {
"string": {
"type": "string"
}
},
"variables": {
"string": "string",
"int": 42,
"bool": true,
"array": [
1,
2,
3,
4
],
"object": {
"object": {
"vmSize": "Large",
"location": "West US"
}
}
},
"resources": [],
"outputs": {
"string": {
"type": "string",
"value": "myvalue"
}
}
},
"q1": "first",
"q2": 42,
"q3": 422222222222222222222222222222222222,
"q4": 3.14,
"q5": 3.14159265358,
"q6": true
},
"responses": {
"200": {
"body": {
"minifiedTemplate": "{\"$SCHEMA\":\"HTTP://SCHEMAS.MANAGEMENT.AZURE.COM/DEPLOYMENTTEMPLATE?API-VERSION=2014-04-01-PREVIEW\",\"CONTENTVERSION\":\"1.0.0.0\",\"PARAMETERS\":{\"STRING\":{\"TYPE\":\"STRING\"}},\"VARIABLES\":{\"STRING\":\"STRING\",\"INT\":42,\"BOOL\":TRUE,\"ARRAY\":[1,2,3,4],\"OBJECT\":{\"OBJECT\":{\"VMSIZE\":\"LARGE\",\"LOCATION\":\"WEST US\"}}},\"RESOURCES\":[],\"OUTPUTS\":{\"STRING\":{\"TYPE\":\"STRING\",\"VALUE\":\"MYVALUE\"}}}",
"templateHash": "695440707931307747"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,53 @@
"type": "object"
},
"description": "The template provided to calculate hash."
},
{
"name": "q1",
"in": "query",
"type": "string",
"description": "The first query parameter"
},
{
"name": "q2",
"in": "query",
"type": "integer",
"description": "The second query parameter"
},
{
"name": "q3",
"in": "query",
"type": "integer",
"format": "int64",
"description": "The third query parameter"
},
{
"name": "q4",
"in": "query",
"type": "number",
"format": "float",
"description": "The fourth query parameter"
},
{
"name": "q5",
"in": "query",
"type": "number",
"format": "double",
"description": "The fifth query parameter"
},
{
"name": "q6",
"in": "query",
"type": "boolean",
"description": "The sixth query parameter"
}
],
"x-ms-examples": {
"Calculate template hash": {
"$ref": "./examples/resources/CalculateTemplateHash.json"
},
"Calculate template hash with query parameters": {
"$ref": "./examples/resources/CalculateTemplateHashWithQueryParameters.json"
}
},
"responses": {
Expand Down
Loading