@@ -11,25 +11,23 @@ namespace Microsoft.OpenApi.Tests.Mocks
11
11
{
12
12
public class OpenApiOperationSerializationTests
13
13
{
14
- private static readonly OpenApiOperation _operation = OpenApiDocumentMock . CreateCompleteOpenApiDocument ( ) . Paths [ "/pets" ] . Operations [ HttpMethod . Get ] ;
15
-
16
- private static readonly Mock < OpenApiCallback > _callbackMock = new ( ) { CallBase = true } ;
17
- private static readonly Mock < OpenApiPathItem > _pathItemMock = new ( ) { CallBase = true } ;
18
- private static readonly Mock < OpenApiRequestBody > _requestBodyMock = new ( ) { CallBase = true } ;
19
- private static readonly Mock < OpenApiResponse > _responsesMock = new ( ) { CallBase = true } ;
20
- private static readonly Mock < OpenApiParameter > _parameterMock = new ( ) { CallBase = true } ;
21
- private static readonly Mock < OpenApiSecurityRequirement > _securityRequirementMock = new ( ) { CallBase = true } ;
22
- private static readonly Mock < OpenApiTagReference > _tagMock = new ( ) { CallBase = true } ;
14
+ private readonly OpenApiOperation _operation ;
15
+ private readonly Mock < OpenApiCallback > _callbackMock = new ( ) { CallBase = true } ;
16
+ private readonly Mock < OpenApiPathItem > _pathItemMock = new ( ) { CallBase = true } ;
17
+ private readonly Mock < OpenApiRequestBody > _requestBodyMock = new ( ) { CallBase = true } ;
18
+ private readonly Mock < OpenApiResponse > _responsesMock = new ( ) { CallBase = true } ;
19
+ private readonly Mock < OpenApiParameter > _parameterMock = new ( ) { CallBase = true } ;
20
+ private readonly Mock < OpenApiSecurityRequirement > _securityRequirementMock = new ( ) { CallBase = true } ;
23
21
24
22
25
23
public OpenApiOperationSerializationTests ( )
26
24
{
25
+ _operation = OpenApiDocumentMock . CreateCompleteOpenApiDocument ( ) . Paths [ "/pets" ] . Operations [ HttpMethod . Get ] ;
27
26
_operation . Callbacks [ "onData" ] = _callbackMock . Object ;
28
27
_operation . Responses [ "200" ] = _responsesMock . Object ;
29
28
_operation . RequestBody = _requestBodyMock . Object ;
30
29
_operation . Parameters [ 0 ] = _parameterMock . Object ;
31
30
_operation . Security [ 0 ] = _securityRequirementMock . Object ;
32
- _operation . Tags . ToList ( ) [ 0 ] = _tagMock . Object ;
33
31
}
34
32
35
33
[ Fact ]
@@ -60,9 +58,6 @@ public void SerializeAsV31_DoesNotCallV3OrV2Serialization()
60
58
61
59
_securityRequirementMock . Verify ( c => c . SerializeAsV3 ( It . IsAny < IOpenApiWriter > ( ) ) , Times . Never , "V3 method should not be called" ) ;
62
60
_securityRequirementMock . Verify ( c => c . SerializeAsV2 ( It . IsAny < IOpenApiWriter > ( ) ) , Times . Never , "V2 method should not be called" ) ;
63
-
64
- _tagMock . Verify ( c => c . SerializeAsV3 ( It . IsAny < IOpenApiWriter > ( ) ) , Times . Never , "V3 method should not be called" ) ;
65
- _tagMock . Verify ( c => c . SerializeAsV2 ( It . IsAny < IOpenApiWriter > ( ) ) , Times . Never , "V2 method should not be called" ) ;
66
61
}
67
62
68
63
[ Fact ]
@@ -93,9 +88,6 @@ public void SerializeAsV3_DoesNotCallV31OrV2Serialization()
93
88
94
89
_securityRequirementMock . Verify ( c => c . SerializeAsV31 ( It . IsAny < IOpenApiWriter > ( ) ) , Times . Never , "V31 method should not be called" ) ;
95
90
_securityRequirementMock . Verify ( c => c . SerializeAsV2 ( It . IsAny < IOpenApiWriter > ( ) ) , Times . Never , "V2 method should not be called" ) ;
96
-
97
- _tagMock . Verify ( c => c . SerializeAsV31 ( It . IsAny < IOpenApiWriter > ( ) ) , Times . Never , "V31 method should not be called" ) ;
98
- _tagMock . Verify ( c => c . SerializeAsV2 ( It . IsAny < IOpenApiWriter > ( ) ) , Times . Never , "V2 method should not be called" ) ;
99
91
}
100
92
}
101
93
}
0 commit comments