Skip to content

Commit

Permalink
Add more tests to payload/xml (#648)
Browse files Browse the repository at this point in the history
* Add more tests to payload/xml

Includes types that use TypeSpec.Xml decorators.

* split naming into separate tests

added scenario for encodedName

* fix incorrect casing
  • Loading branch information
jhendrixMSFT authored Jul 31, 2024
1 parent 98801d1 commit b06f27c
Show file tree
Hide file tree
Showing 6 changed files with 680 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/curly-walls-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@azure-tools/cadl-ranch-specs": minor
---

added more tests to payload/xml
254 changes: 254 additions & 0 deletions packages/cadl-ranch-specs/cadl-ranch-summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -2943,6 +2943,126 @@ Expected request body:
</ModelWithArrayOfModel>
```

### Payload_Xml_ModelWithAttributesValue_get

- Endpoint: `get /payload/xml/modelWithAttributes`

Expected response body:

```xml
<ModelWithAttributes id1="123" id2="foo">
<enabled>true</enabled>
</ModelWithAttributes>
```

### Payload_Xml_ModelWithAttributesValue_put

- Endpoint: `put /payload/xml/modelWithAttributes`

Expected request body:

```xml
<ModelWithAttributes id1="123" id2="foo">
<enabled>true</enabled>
</ModelWithAttributes>
```

### Payload_Xml_ModelWithDictionaryValue_get

- Endpoint: `get /payload/xml/modelWithDictionary`

Expected response body:

```xml
<ModelWithDictionary>
<metadata>
<Color>blue</Color>
<Count>123</Count>
<Enabled>false</Enabled>
</metadata>
</ModelWithDictionary>
```

### Payload_Xml_ModelWithDictionaryValue_put

- Endpoint: `put /payload/xml/modelWithDictionary`

Expected request body:

```xml
<ModelWithDictionary>
<metadata>
<Color>blue</Color>
<Count>123</Count>
<Enabled>false</Enabled>
</metadata>
</ModelWithDictionary>
```

### Payload_Xml_ModelWithEmptyArrayValue_get

- Endpoint: `get /payload/xml/modelWithEmptyArray`

Expected response body:

```xml
<ModelWithEmptyArray>
<items />
</ModelWithEmptyArray>
```

### Payload_Xml_ModelWithEmptyArrayValue_put

- Endpoint: `put /payload/xml/modelWithEmptyArray`

Expected request body:

```xml
<ModelWithEmptyArray>
<items />
</ModelWithEmptyArray>
```

### Payload_Xml_ModelWithEncodedNamesValue_get

- Endpoint: `get /payload/xml/modelWithEncodedNames`

Expected response body:

```xml
<ModelWithEncodedNamesSrc>
<SimpleModelData>
<name>foo</name>
<age>123</age>
</SimpleModelData>
<PossibleColors>
<string>red</string>
<string>green</string>
<string>blue</string>
</PossibleColors>
</ModelWithEncodedNamesSrc>
```

### Payload_Xml_ModelWithEncodedNamesValue_put

- Endpoint: `put /payload/xml/modelWithEncodedNames`

Expected request body:

```xml
<ModelWithEncodedNamesSrc>
<SimpleModelData>
<name>foo</name>
<age>123</age>
</SimpleModelData>
<PossibleColors>
<string>red</string>
<string>green</string>
<string>blue</string>
</PossibleColors>
</ModelWithEncodedNamesSrc>
```

### Payload_Xml_ModelWithOptionalFieldValue_get

- Endpoint: `get /payload/xml/modelWithOptionalField`
Expand All @@ -2967,6 +3087,80 @@ Expected request body:
</ModelWithOptionalField>
```

### Payload_Xml_ModelWithRenamedArraysValue_get

- Endpoint: `get /payload/xml/modelWithRenamedArrays`

Expected response body:

```xml
<ModelWithRenamedArrays>
<Colors>red</Colors>
<Colors>green</Colors>
<Colors>blue</Colors>
<Counts>
<int32>1</int32>
<int32>2</int32>
</Counts>
</ModelWithRenamedArrays>
```

### Payload_Xml_ModelWithRenamedArraysValue_put

- Endpoint: `put /payload/xml/modelWithRenamedArrays`

Expected request body:

```xml
<ModelWithRenamedArrays>
<Colors>red</Colors>
<Colors>green</Colors>
<Colors>blue</Colors>
<Counts>
<int32>1</int32>
<int32>2</int32>
</Counts>
</ModelWithRenamedArrays>
```

### Payload_Xml_ModelWithRenamedFieldsValue_get

- Endpoint: `get /payload/xml/modelWithRenamedFields`

Expected response body:

```xml
<ModelWithRenamedFieldsSrc>
<InputData>
<name>foo</name>
<age>123</age>
</InputData>
<OutputData>
<name>bar</name>
<age>456</age>
</OutputData>
</ModelWithRenamedFieldsSrc>
```

### Payload_Xml_ModelWithRenamedFieldsValue_put

- Endpoint: `put /payload/xml/modelWithRenamedFields`

Expected request body:

```xml
<ModelWithRenamedFieldsSrc>
<InputData>
<name>foo</name>
<age>123</age>
</InputData>
<OutputData>
<name>bar</name>
<age>456</age>
</OutputData>
</ModelWithRenamedFieldsSrc>
```

### Payload_Xml_ModelWithSimpleArraysValue_get

- Endpoint: `get /payload/xml/modelWithSimpleArrays`
Expand Down Expand Up @@ -3007,6 +3201,66 @@ Expected request body:
</ModelWithSimpleArrays>
```

### Payload_Xml_ModelWithTextValue_get

- Endpoint: `get /payload/xml/modelWithText`

Expected response body:

```xml
<ModelWithText language="foo">
This is some text.
</ModelWithText>
```

### Payload_Xml_ModelWithTextValue_put

- Endpoint: `put /payload/xml/modelWithText`

Expected request body:

```xml
<ModelWithText language="foo">
This is some text.
</ModelWithText>
```

### Payload_Xml_ModelWithUnwrappedArrayValue_get

- Endpoint: `get /payload/xml/modelWithUnwrappedArray`

Expected response body:

```xml
<ModelWithUnwrappedArray>
<colors>red</colors>
<colors>green</colors>
<colors>blue</colors>
<counts>
<int32>1</int32>
<int32>2</int32>
</counts>
</ModelWithUnwrappedArray>
```

### Payload_Xml_ModelWithUnwrappedArrayValue_put

- Endpoint: `put /payload/xml/modelWithUnwrappedArray`

Expected request body:

```xml
<ModelWithUnwrappedArray>
<colors>red</colors>
<colors>green</colors>
<colors>blue</colors>
<counts>
<int32>1</int32>
<int32>2</int32>
</counts>
</ModelWithUnwrappedArray>
```

### Payload_Xml_SimpleModelValue_get

- Endpoint: `get /payload/xml/simpleModel`
Expand Down
Loading

0 comments on commit b06f27c

Please sign in to comment.