Skip to content

Commit 9ffffb0

Browse files
committed
fix: adds missing document references to all unit tests
Signed-off-by: Vincent Biret <[email protected]>
1 parent b1942fc commit 9ffffb0

File tree

44 files changed

+85
-61
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+85
-61
lines changed

test/Microsoft.OpenAPI.OData.Reader.Tests/Generator/OpenApiPathItemGeneratorTests.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using Microsoft.OData.Edm.Csdl;
1010
using Microsoft.OData.Edm.Vocabularies;
1111
using Microsoft.OData.Edm.Vocabularies.Community.V1;
12+
using Microsoft.OpenApi.Models;
1213
using Microsoft.OpenApi.OData.Edm;
1314
using Microsoft.OpenApi.OData.Tests;
1415
using Microsoft.OpenApi.OData.Vocabulary.Capabilities;
@@ -22,21 +23,23 @@ public class OpenApiPathItemGeneratorTest
2223
public void CreatePathItemsThrowArgumentNullContext()
2324
{
2425
// Arrange
26+
OpenApiDocument openApiDocument = new();
2527
ODataContext context = null;
2628

2729
// Act & Assert
28-
Assert.Throws<ArgumentNullException>("context", () => context.CreatePathItems());
30+
Assert.Throws<ArgumentNullException>("context", () => context.CreatePathItems(openApiDocument));
2931
}
3032

3133
[Fact]
3234
public void CreatePathItemsReturnsForEmptyModel()
3335
{
3436
// Arrange
3537
IEdmModel model = EdmModelHelper.EmptyModel;
38+
OpenApiDocument openApiDocument = new();
3639
ODataContext context = new ODataContext(model);
3740

3841
// Act
39-
var pathItems = context.CreatePathItems();
42+
var pathItems = context.CreatePathItems(openApiDocument);
4043

4144
// Assert
4245
Assert.NotNull(pathItems);
@@ -50,6 +53,7 @@ public void CreatePathItemsReturnsForBasicModel(bool useAnnotationToGeneratePath
5053
{
5154
// Arrange
5255
IEdmModel model = EdmModelHelper.BasicEdmModel;
56+
OpenApiDocument openApiDocument = new();
5357
OpenApiConvertSettings settings = new OpenApiConvertSettings
5458
{
5559
EnableKeyAsSegment = true,
@@ -58,7 +62,7 @@ public void CreatePathItemsReturnsForBasicModel(bool useAnnotationToGeneratePath
5862
ODataContext context = new ODataContext(model, settings);
5963

6064
// Act
61-
var pathItems = context.CreatePathItems();
65+
var pathItems = context.CreatePathItems(openApiDocument);
6266

6367
// Assert
6468
Assert.NotNull(pathItems);
@@ -115,6 +119,7 @@ public void CreatePathItemsReturnsForEscapeFunctionModel(bool enableEscaped, boo
115119
{
116120
// Arrange
117121
EdmModel model = new EdmModel();
122+
OpenApiDocument openApiDocument = new();
118123
EdmEntityType customer = new EdmEntityType("NS", "Customer");
119124
customer.AddKeys(customer.AddStructuralProperty("ID", EdmPrimitiveTypeKind.Int32));
120125
model.AddElement(customer);
@@ -144,7 +149,7 @@ public void CreatePathItemsReturnsForEscapeFunctionModel(bool enableEscaped, boo
144149
ODataContext context = new ODataContext(model, settings);
145150

146151
// Act
147-
var pathItems = context.CreatePathItems();
152+
var pathItems = context.CreatePathItems(openApiDocument);
148153

149154
// Assert
150155
Assert.NotNull(pathItems);
@@ -161,6 +166,7 @@ public void CreatePathItemsDoesNotAddPathItemEntryForPathItemsWithNoOperations()
161166
{
162167
// Arrange
163168
EdmModel model = new();
169+
OpenApiDocument openApiDocument = new();
164170
EdmEntityType customer = new("NS", "Customer");
165171
customer.AddKeys(customer.AddStructuralProperty("ID", EdmPrimitiveTypeKind.Int32));
166172
model.AddElement(customer);
@@ -199,7 +205,7 @@ public void CreatePathItemsDoesNotAddPathItemEntryForPathItemsWithNoOperations()
199205
ODataContext context = new(model);
200206

201207
// Act
202-
var pathItems = context.CreatePathItems();
208+
var pathItems = context.CreatePathItems(openApiDocument);
203209

204210
// Assert
205211
Assert.NotNull(pathItems);

test/Microsoft.OpenAPI.OData.Reader.Tests/Generator/OpenApiPathsGeneratorTests.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
using System;
77
using Microsoft.OData.Edm;
8+
using Microsoft.OpenApi.Models;
89
using Microsoft.OpenApi.OData.Edm;
910
using Microsoft.OpenApi.OData.Tests;
1011
using Xunit;
@@ -19,21 +20,23 @@ public class OpenApiPathsGeneratorTest
1920
public void CreatePathsThrowArgumentNullContext()
2021
{
2122
// Arrange
23+
OpenApiDocument openApiDocument = new();
2224
ODataContext context = null;
2325

2426
// Act & Assert
25-
Assert.Throws<ArgumentNullException>("context", () => context.CreatePaths());
27+
Assert.Throws<ArgumentNullException>("context", () => context.CreatePaths(openApiDocument));
2628
}
2729

2830
[Fact]
2931
public void CreatePathsReturnsForEmptyModel()
3032
{
3133
// Arrange
3234
IEdmModel model = EdmModelHelper.EmptyModel;
35+
OpenApiDocument openApiDocument = new();
3336
ODataContext context = new ODataContext(model);
3437

3538
// Act
36-
var paths = context.CreatePaths();
39+
var paths = context.CreatePaths(openApiDocument);
3740

3841
// Assert
3942
Assert.NotNull(paths);
@@ -47,6 +50,7 @@ public void CreatePathsReturnsForBasicModel(bool useAnnotationToGeneratePath, in
4750
{
4851
// Arrange
4952
IEdmModel model = EdmModelHelper.BasicEdmModel;
53+
OpenApiDocument openApiDocument = new();
5054
OpenApiConvertSettings settings = new OpenApiConvertSettings
5155
{
5256
EnableKeyAsSegment = true,
@@ -55,7 +59,7 @@ public void CreatePathsReturnsForBasicModel(bool useAnnotationToGeneratePath, in
5559
ODataContext context = new ODataContext(model, settings);
5660

5761
// Act
58-
var paths = context.CreatePaths();
62+
var paths = context.CreatePaths(openApiDocument);
5963

6064
// Assert
6165
Assert.NotNull(paths);
@@ -106,6 +110,7 @@ public void CreatePathsReturnsForBasicModelWithPrefix(bool useAnnotationToGenera
106110
{
107111
// Arrange
108112
IEdmModel model = EdmModelHelper.BasicEdmModel;
113+
OpenApiDocument openApiDocument = new();
109114
OpenApiConvertSettings settings = new OpenApiConvertSettings
110115
{
111116
EnableKeyAsSegment = true,
@@ -115,7 +120,7 @@ public void CreatePathsReturnsForBasicModelWithPrefix(bool useAnnotationToGenera
115120
ODataContext context = new ODataContext(model, settings);
116121

117122
// Act
118-
var paths = context.CreatePaths();
123+
var paths = context.CreatePaths(openApiDocument);
119124

120125
// Assert
121126
Assert.NotNull(paths);
@@ -164,6 +169,7 @@ public void CreatePathsReturnsForContractModelWithHierarhicalClass()
164169
{
165170
// Arrange
166171
IEdmModel model = EdmModelHelper.ContractServiceModel;
172+
OpenApiDocument openApiDocument = new();
167173
OpenApiConvertSettings settings = new OpenApiConvertSettings
168174
{
169175
EnableKeyAsSegment = true,
@@ -172,7 +178,7 @@ public void CreatePathsReturnsForContractModelWithHierarhicalClass()
172178
ODataContext context = new ODataContext(model, settings);
173179

174180
// Act
175-
var paths = context.CreatePaths();
181+
var paths = context.CreatePaths(openApiDocument);
176182

177183
// Assert
178184
Assert.NotNull(paths);

test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/ComplexPropertyGetOperationHandlerTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace Microsoft.OpenApi.OData.Operation.Tests;
1313

1414
public class ComplexPropertyGetOperationHandlerTests
1515
{
16-
private readonly ComplexPropertyGetOperationHandler _operationHandler = new();
16+
private readonly ComplexPropertyGetOperationHandler _operationHandler = new(new());
1717

1818
[Theory]
1919
[InlineData(true)]

test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/ComplexPropertyPatchOperationHandlerTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace Microsoft.OpenApi.OData.Operation.Tests;
1313

1414
public class ComplexPropertyPatchOperationHandlerTests
1515
{
16-
private readonly ComplexPropertyPatchOperationHandler _operationHandler = new();
16+
private readonly ComplexPropertyPatchOperationHandler _operationHandler = new(new());
1717

1818
[Theory]
1919
[InlineData(true)]

test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/ComplexPropertyPostOperationHandlerTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace Microsoft.OpenApi.OData.Operation.Tests;
1313

1414
public class ComplexPropertyPostOperationHandlerTests
1515
{
16-
private readonly ComplexPropertyPostOperationHandler _operationHandler = new();
16+
private readonly ComplexPropertyPostOperationHandler _operationHandler = new(new());
1717
[Fact]
1818
public void CreateComplexPropertyPostOperationThrowsForSingle()
1919
{

test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/ComplexPropertyPutOperationHandlerTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace Microsoft.OpenApi.OData.Operation.Tests;
1313

1414
public class ComplexPropertyPutOperationHandlerTests
1515
{
16-
private readonly ComplexPropertyPutOperationHandler _operationHandler = new();
16+
private readonly ComplexPropertyPutOperationHandler _operationHandler = new(new());
1717

1818
[Theory]
1919
[InlineData(true, true)]

test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/DollarCountGetOperationHandlerTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace Microsoft.OpenApi.OData.Operation.Tests
1414
{
1515
public class DollarCountGetOperationHandlerTests
1616
{
17-
private readonly DollarCountGetOperationHandler _operationHandler = new();
17+
private readonly DollarCountGetOperationHandler _operationHandler = new(new());
1818

1919
[Theory]
2020
[InlineData(true, true)]

test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/EdmActionImportOperationHandlerTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace Microsoft.OpenApi.OData.Operation.Tests
1616
{
1717
public class EdmActionImportOperationHandlerTests
1818
{
19-
private EdmActionImportOperationHandler _operationHandler = new EdmActionImportOperationHandler();
19+
private EdmActionImportOperationHandler _operationHandler = new EdmActionImportOperationHandler(new());
2020

2121
[Fact]
2222
public void CreateOperationForEdmActionImportReturnsCorrectOperation()

test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/EdmActionOperationHandlerTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace Microsoft.OpenApi.OData.Operation.Tests
1616
{
1717
public class EdmActionOperationHandlerTests
1818
{
19-
private EdmActionOperationHandler _operationHandler = new EdmActionOperationHandler();
19+
private EdmActionOperationHandler _operationHandler = new EdmActionOperationHandler(new());
2020

2121
[Fact]
2222
public void CreateOperationForEdmActionReturnsCorrectOperation()

test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/EdmFunctionImportOperationHandlerTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace Microsoft.OpenApi.OData.Operation.Tests
1616
{
1717
public class EdmFunctionImportOperationHandlerTests
1818
{
19-
private EdmFunctionImportOperationHandler _operationHandler = new EdmFunctionImportOperationHandler();
19+
private EdmFunctionImportOperationHandler _operationHandler = new EdmFunctionImportOperationHandler(new());
2020

2121
[Theory]
2222
[InlineData(true)]

0 commit comments

Comments
 (0)