File tree 4 files changed +16
-5
lines changed
OpenApiTests/NamingConventions
4 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -140,7 +140,10 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint()
140
140
. SchemaReferenceId ;
141
141
} ) ;
142
142
143
- schemasElement . Should ( ) . ContainPath ( $ "{ relatedResourceTypeSchemaRefId } .enum[0]") . ShouldBeSchemaReferenceId ( "staffMembers" ) ;
143
+ schemasElement . Should ( ) . ContainPath ( $ "{ relatedResourceTypeSchemaRefId } .enum[0]") . With ( enumValueElement =>
144
+ {
145
+ enumValueElement . Should ( ) . Be ( "staffMembers" ) ;
146
+ } ) ;
144
147
} ) ;
145
148
}
146
149
Original file line number Diff line number Diff line change @@ -140,7 +140,10 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint()
140
140
. SchemaReferenceId ;
141
141
} ) ;
142
142
143
- schemasElement . Should ( ) . ContainPath ( $ "{ relatedResourceTypeSchemaRefId } .enum[0]") . ShouldBeSchemaReferenceId ( "staff-members" ) ;
143
+ schemasElement . Should ( ) . ContainPath ( $ "{ relatedResourceTypeSchemaRefId } .enum[0]") . With ( enumValueElement =>
144
+ {
145
+ enumValueElement . Should ( ) . Be ( "staff-members" ) ;
146
+ } ) ;
144
147
} ) ;
145
148
}
146
149
Original file line number Diff line number Diff line change @@ -141,7 +141,10 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint()
141
141
. SchemaReferenceId ;
142
142
} ) ;
143
143
144
- schemasElement . Should ( ) . ContainPath ( $ "{ relatedResourceTypeSchemaRefId } .enum[0]") . ShouldBeSchemaReferenceId ( "StaffMembers" ) ;
144
+ schemasElement . Should ( ) . ContainPath ( $ "{ relatedResourceTypeSchemaRefId } .enum[0]") . With ( enumValueElement =>
145
+ {
146
+ enumValueElement . Should ( ) . Be ( "StaffMembers" ) ;
147
+ } ) ;
145
148
} ) ;
146
149
}
147
150
Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ namespace TestBuildingBlocks;
8
8
9
9
public static class JsonElementAssertionExtensions
10
10
{
11
+ private const string ComponentSchemaPrefix = "#/components/schemas/" ;
12
+
11
13
public static JsonElementAssertions Should ( this JsonElement source )
12
14
{
13
15
return new JsonElementAssertions ( source ) ;
@@ -28,9 +30,9 @@ private static string GetSchemaReferenceId(this JsonElement source)
28
30
source . ValueKind . Should ( ) . Be ( JsonValueKind . String ) ;
29
31
30
32
string ? jsonElementValue = source . GetString ( ) ;
31
- jsonElementValue . ShouldNotBeNull ( ) ;
33
+ jsonElementValue . Should ( ) . StartWith ( ComponentSchemaPrefix ) ;
32
34
33
- return jsonElementValue . Split ( '/' ) . Last ( ) ;
35
+ return jsonElementValue ! [ ComponentSchemaPrefix . Length .. ] ;
34
36
}
35
37
36
38
[ CustomAssertion ]
You can’t perform that action at this time.
0 commit comments