Skip to content

Commit 2e03505

Browse files
committed
Refactor tests to reflect change
1 parent 8c9047f commit 2e03505

38 files changed

+438
-436
lines changed

test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ public void RemoveAnyOfAndOneOfFromSchema()
6666
Assert.NotNull(openApiDocument.Components.Schemas);
6767
Assert.NotNull(testSchema);
6868
Assert.Null(averageAudioDegradationProperty?.AnyOf);
69-
Assert.Equal("number", averageAudioDegradationProperty?.Type);
69+
Assert.Equal(JsonSchemaType.Number, averageAudioDegradationProperty?.Type);
7070
Assert.Equal("float", averageAudioDegradationProperty?.Format);
7171
Assert.True(averageAudioDegradationProperty?.Nullable);
7272
Assert.Null(defaultPriceProperty?.OneOf);
73-
Assert.Equal("number", defaultPriceProperty?.Type);
73+
Assert.Equal(JsonSchemaType.Number, defaultPriceProperty?.Type);
7474
Assert.Equal("double", defaultPriceProperty?.Format);
7575
Assert.NotNull(testSchema.AdditionalProperties);
7676
}
@@ -91,7 +91,7 @@ public void ResolveFunctionParameters()
9191
// Assert
9292
Assert.Null(idsParameter?.Content);
9393
Assert.NotNull(idsParameter?.Schema);
94-
Assert.Equal("array", idsParameter?.Schema.Type);
94+
Assert.Equal(JsonSchemaType.Array, idsParameter?.Schema.Type);
9595
}
9696

9797
private static OpenApiDocument GetSampleOpenApiDocument()
@@ -123,10 +123,10 @@ private static OpenApiDocument GetSampleOpenApiDocument()
123123
{
124124
Schema = new()
125125
{
126-
Type = "array",
126+
Type = JsonSchemaType.Array,
127127
Items = new()
128128
{
129-
Type = "string"
129+
Type = JsonSchemaType.String
130130
}
131131
}
132132
}
@@ -152,16 +152,16 @@ private static OpenApiDocument GetSampleOpenApiDocument()
152152
{
153153
{ "TestSchema", new OpenApiSchema
154154
{
155-
Type = "object",
155+
Type = JsonSchemaType.Object,
156156
Properties = new Dictionary<string, OpenApiSchema>
157157
{
158158
{
159159
"averageAudioDegradation", new OpenApiSchema
160160
{
161161
AnyOf = new List<OpenApiSchema>
162162
{
163-
new() { Type = "number" },
164-
new() { Type = "string" }
163+
new() { Type = JsonSchemaType.Number },
164+
new() { Type = JsonSchemaType.String }
165165
},
166166
Format = "float",
167167
Nullable = true
@@ -172,8 +172,8 @@ private static OpenApiDocument GetSampleOpenApiDocument()
172172
{
173173
OneOf = new List<OpenApiSchema>
174174
{
175-
new() { Type = "number", Format = "double" },
176-
new() { Type = "string" }
175+
new() { Type = JsonSchemaType.Number, Format = "double" },
176+
new() { Type = JsonSchemaType.String }
177177
}
178178
}
179179
}

test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public void CreateFilteredDocumentUsingPredicateFromRequestUrl()
131131
Required = true,
132132
Schema = new()
133133
{
134-
Type = "string"
134+
Type = JsonSchemaType.String
135135
}
136136
}
137137
}

test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public static OpenApiDocument CreateOpenApiDocument()
8585
Required = true,
8686
Schema = new()
8787
{
88-
Type = "string"
88+
Type = JsonSchemaType.String
8989
}
9090
}
9191
}
@@ -104,7 +104,7 @@ public static OpenApiDocument CreateOpenApiDocument()
104104
{
105105
Schema = new()
106106
{
107-
Type = "array"
107+
Type = JsonSchemaType.Array
108108
}
109109
}
110110
}
@@ -125,7 +125,7 @@ public static OpenApiDocument CreateOpenApiDocument()
125125
Required = true,
126126
Schema = new()
127127
{
128-
Type = "string"
128+
Type = JsonSchemaType.String
129129
}
130130
}
131131
}
@@ -159,7 +159,7 @@ public static OpenApiDocument CreateOpenApiDocument()
159159
Required = true,
160160
Schema = new()
161161
{
162-
Type = "string"
162+
Type = JsonSchemaType.String
163163
}
164164
}
165165
}
@@ -178,7 +178,7 @@ public static OpenApiDocument CreateOpenApiDocument()
178178
{
179179
Schema = new()
180180
{
181-
Type = "array"
181+
Type = JsonSchemaType.Array
182182
}
183183
}
184184
}
@@ -198,7 +198,7 @@ public static OpenApiDocument CreateOpenApiDocument()
198198
Required = true,
199199
Schema = new()
200200
{
201-
Type = "string"
201+
Type = JsonSchemaType.String
202202
}
203203
}
204204
}
@@ -236,14 +236,14 @@ public static OpenApiDocument CreateOpenApiDocument()
236236
Schema = new()
237237
{
238238
Title = "Collection of user",
239-
Type = "object",
239+
Type = JsonSchemaType.Object,
240240
Properties = new Dictionary<string, OpenApiSchema>
241241
{
242242
{
243243
"value",
244244
new OpenApiSchema
245245
{
246-
Type = "array",
246+
Type = JsonSchemaType.Array,
247247
Items = new()
248248
{
249249
Reference = new()
@@ -368,7 +368,7 @@ public static OpenApiDocument CreateOpenApiDocument()
368368
Description = "Select properties to be returned",
369369
Schema = new()
370370
{
371-
Type = "array"
371+
Type = JsonSchemaType.Array
372372
}
373373
// missing explode parameter
374374
}
@@ -432,7 +432,7 @@ public static OpenApiDocument CreateOpenApiDocument()
432432
Description = "key: id of administrativeUnit",
433433
Schema = new()
434434
{
435-
Type = "string"
435+
Type = JsonSchemaType.String
436436
}
437437
}
438438
}
@@ -455,7 +455,7 @@ public static OpenApiDocument CreateOpenApiDocument()
455455
{
456456
new()
457457
{
458-
Type = "string"
458+
Type = JsonSchemaType.String
459459
}
460460
},
461461
Nullable = true
@@ -534,14 +534,14 @@ public static OpenApiDocument CreateOpenApiDocument()
534534
Schema = new()
535535
{
536536
Title = "Collection of hostSecurityProfile",
537-
Type = "object",
537+
Type = JsonSchemaType.Object,
538538
Properties = new Dictionary<string, OpenApiSchema>
539539
{
540540
{
541541
"value",
542542
new OpenApiSchema
543543
{
544-
Type = "array",
544+
Type = JsonSchemaType.Array,
545545
Items = new()
546546
{
547547
Reference = new()
@@ -592,7 +592,7 @@ public static OpenApiDocument CreateOpenApiDocument()
592592
Required = true,
593593
Schema = new()
594594
{
595-
Type = "string"
595+
Type = JsonSchemaType.String
596596
},
597597
Extensions = new Dictionary<string, IOpenApiExtension>
598598
{
@@ -647,7 +647,7 @@ public static OpenApiDocument CreateOpenApiDocument()
647647
Required = true,
648648
Schema = new()
649649
{
650-
Type = "string"
650+
Type = JsonSchemaType.String
651651
},
652652
Extensions = new Dictionary<string, IOpenApiExtension>
653653
{
@@ -664,7 +664,7 @@ public static OpenApiDocument CreateOpenApiDocument()
664664
Required = true,
665665
Schema = new()
666666
{
667-
Type = "string"
667+
Type = JsonSchemaType.String
668668
},
669669
Extensions = new Dictionary<string, IOpenApiExtension>
670670
{
@@ -688,7 +688,7 @@ public static OpenApiDocument CreateOpenApiDocument()
688688
{
689689
Schema = new()
690690
{
691-
Type = "array",
691+
Type = JsonSchemaType.Array,
692692
Reference = new()
693693
{
694694
Type = ReferenceType.Schema,
@@ -740,13 +740,13 @@ public static OpenApiDocument CreateOpenApiDocument()
740740
"microsoft.graph.networkInterface", new OpenApiSchema
741741
{
742742
Title = "networkInterface",
743-
Type = "object",
743+
Type = JsonSchemaType.Object,
744744
Properties = new Dictionary<string, OpenApiSchema>
745745
{
746746
{
747747
"description", new OpenApiSchema
748748
{
749-
Type = "string",
749+
Type = JsonSchemaType.String,
750750
Description = "Description of the NIC (e.g. Ethernet adapter, Wireless LAN adapter Local Area Connection <#>, etc.).",
751751
Nullable = true
752752
}

test/Microsoft.OpenApi.Readers.Tests/ReferenceService/TryLoadReferenceV2Tests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public void LoadParameterReference()
3838
Required = true,
3939
Schema = new()
4040
{
41-
Type = "integer",
41+
Type = JsonSchemaType.Integer,
4242
Format = "int32"
4343
}
4444

@@ -106,11 +106,11 @@ public void LoadResponseAndSchemaReference()
106106
Properties = {
107107
["name"] = new()
108108
{
109-
Type = "string"
109+
Type = JsonSchemaType.String
110110
},
111111
["tag"] = new()
112112
{
113-
Type = "string"
113+
Type = JsonSchemaType.String
114114
}
115115
},
116116

test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiDocumentTests.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ public void ParseDocumentWithDifferentCultureShouldSucceed(string culture)
7575
{
7676
["sampleSchema"] = new()
7777
{
78-
Type = "object",
78+
Type = JsonSchemaType.Object,
7979
Properties =
8080
{
8181
["sampleProperty"] = new()
8282
{
83-
Type = "double",
83+
Type = JsonSchemaType.Number,
8484
Minimum = (decimal)100.54,
8585
Maximum = (decimal)60000000.35,
8686
ExclusiveMaximum = true,
@@ -119,7 +119,7 @@ public void ShouldParseProducesInAnyOrder()
119119
{
120120
{ "id", new OpenApiSchema
121121
{
122-
Type = "string",
122+
Type = JsonSchemaType.String,
123123
Description = "Item identifier."
124124
}
125125
}
@@ -132,18 +132,18 @@ public void ShouldParseProducesInAnyOrder()
132132
{
133133
{ "code", new OpenApiSchema
134134
{
135-
Type = "integer",
135+
Type = JsonSchemaType.Integer,
136136
Format = "int32"
137137
}
138138
},
139139
{ "message", new OpenApiSchema
140140
{
141-
Type = "string"
141+
Type = JsonSchemaType.String
142142
}
143143
},
144144
{ "fields", new OpenApiSchema
145145
{
146-
Type = "string"
146+
Type = JsonSchemaType.String
147147
}
148148
}
149149
}
@@ -153,7 +153,7 @@ public void ShouldParseProducesInAnyOrder()
153153
{
154154
Schema = new()
155155
{
156-
Type = "array",
156+
Type = JsonSchemaType.Array,
157157
Items = new OpenApiSchemaReference("Item", result.OpenApiDocument)
158158
}
159159
};
@@ -277,7 +277,7 @@ public void ShouldAssignSchemaToAllResponses()
277277

278278
var successSchema = new OpenApiSchema
279279
{
280-
Type = "array",
280+
Type = JsonSchemaType.Array,
281281
Items = new OpenApiSchemaReference("Item", result.OpenApiDocument)
282282
};
283283
var errorSchema = new OpenApiSchemaReference("Error", result.OpenApiDocument);

0 commit comments

Comments
 (0)