Skip to content

Commit

Permalink
change the attributes in generated cases (#5150)
Browse files Browse the repository at this point in the history
* change the attributes

* regen

* regen
  • Loading branch information
ArcturusZhang authored Nov 12, 2024
1 parent 8513f93 commit 1849c38
Show file tree
Hide file tree
Showing 35 changed files with 5,506 additions and 5,102 deletions.
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}");
_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

0 comments on commit 1849c38

Please sign in to comment.