Skip to content

Commit

Permalink
Update tests and integration test files
Browse files Browse the repository at this point in the history
  • Loading branch information
irvinesunday committed Oct 2, 2024
1 parent 72a6401 commit c2f0bd3
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public OpenApiRequestBodyGeneratorTest()
var edmAction = new EdmAction("NS", "Checkout", boolType, true, actionEntitySetPath);
edmAction.AddParameter(new EdmOperationParameter(edmAction, "bindingParameter", new EdmEntityTypeReference(customer, true)));
edmAction.AddParameter("param", EdmCoreModel.Instance.GetString(true));
edmAction.AddParameter("param2", EdmCoreModel.Instance.GetString(false));

model.AddElement(edmAction);

var actionImportEntitySetPath = new EdmPathExpression("Param1/Nav2");
Expand Down Expand Up @@ -89,9 +91,17 @@ public void CreateRequestBodyForActionImportReturnCorrectRequestBody()
var schema = content.Value.Schema;
Assert.Equal("object", schema.Type);
Assert.NotNull(schema.Properties);
var parameter = Assert.Single(schema.Properties);
Assert.Equal("param", parameter.Key);
Assert.Equal("string", parameter.Value.Type);

var parameters = schema.Properties;
Assert.Equal(2, parameters.Count);

var parameter1 = parameters.First(p => p.Key == "param");
Assert.Equal("param", parameter1.Key);
Assert.Equal("string", parameter1.Value.Type);

var parameter2 = parameters.First(p => p.Key == "param2");
Assert.Equal("param2", parameter2.Key);
Assert.Equal("string", parameter2.Value.Type);
}

[Fact]
Expand All @@ -116,6 +126,9 @@ public void CanSerializeAsJsonFromTheCreatedRequestBody()
""param"": {
""type"": ""string"",
""nullable"": true
},
""param2"": {
""type"": ""string""
}
}
}
Expand Down Expand Up @@ -146,9 +159,17 @@ public void CreateRequestBodyForActionReturnCorrectRequestBody()
var schema = content.Value.Schema;
Assert.Equal("object", schema.Type);
Assert.NotNull(schema.Properties);
var parameter = Assert.Single(schema.Properties);
Assert.Equal("param", parameter.Key);
Assert.Equal("string", parameter.Value.Type);

var parameters = schema.Properties;
Assert.Equal(2, parameters.Count);

var parameter1 = parameters.First(p => p.Key == "param");
Assert.Equal("param", parameter1.Key);
Assert.Equal("string", parameter1.Value.Type);

var parameter2 = parameters.First(p => p.Key == "param2");
Assert.Equal("param2", parameter2.Key);
Assert.Equal("string", parameter2.Value.Type);
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10943,7 +10943,6 @@
"in": "body",
"name": "body",
"description": "Action parameters",
"required": true,
"schema": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -15768,7 +15767,6 @@
"in": "body",
"name": "body",
"description": "Action parameters",
"required": true,
"schema": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -28333,7 +28331,6 @@
"in": "body",
"name": "body",
"description": "Action parameters",
"required": true,
"schema": {
"type": "object",
"properties": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7362,7 +7362,6 @@ paths:
- in: body
name: body
description: Action parameters
required: true
schema:
type: object
properties:
Expand Down Expand Up @@ -10613,7 +10612,6 @@ paths:
- in: body
name: body
description: Action parameters
required: true
schema:
type: object
properties:
Expand Down Expand Up @@ -19205,7 +19203,6 @@ paths:
- in: body
name: body
description: Action parameters
required: true
schema:
type: object
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12080,8 +12080,7 @@
}
}
}
},
"required": true
}
},
"responses": {
"204": {
Expand Down Expand Up @@ -17516,8 +17515,7 @@
}
}
}
},
"required": true
}
},
"responses": {
"204": {
Expand Down Expand Up @@ -31640,8 +31638,7 @@
}
}
}
},
"required": true
}
},
"responses": {
"204": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8095,7 +8095,6 @@ paths:
- $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person'
- type: object
nullable: true
required: true
responses:
'204':
description: Success
Expand Down Expand Up @@ -11734,7 +11733,6 @@ paths:
- $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person'
- type: object
nullable: true
required: true
responses:
'204':
description: Success
Expand Down Expand Up @@ -21275,7 +21273,6 @@ paths:
- $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person'
- type: object
nullable: true
required: true
responses:
'204':
description: Success
Expand Down

0 comments on commit c2f0bd3

Please sign in to comment.