Skip to content

Commit 945a803

Browse files
committed
Improved naming in OpenApiTests/SchemaProperties
1 parent 7266bc6 commit 945a803

File tree

6 files changed

+41
-41
lines changed

6 files changed

+41
-41
lines changed

test/OpenApiTests/SchemaProperties/NullableReferenceTypesDisabled/ModelStateValidationDisabledTests.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ public ModelStateValidationDisabledTests(
2020
}
2121

2222
[Fact]
23-
public async Task Produces_expected_required_property_in_schema_for_resource()
23+
public async Task Produces_expected_required_property_set_in_schema_for_resource()
2424
{
2525
// Act
2626
JsonElement document = await _testContext.GetSwaggerDocumentAsync();
2727

2828
// Assert
29-
document.ShouldContainPath("components.schemas.chickenAttributesInPostRequest.required").With(requiredElement =>
29+
document.ShouldContainPath("components.schemas.chickenAttributesInPostRequest.required").With(propertySet =>
3030
{
31-
var requiredAttributes = JsonSerializer.Deserialize<List<string>>(requiredElement.GetRawText());
31+
var requiredAttributes = JsonSerializer.Deserialize<List<string>>(propertySet.GetRawText());
3232
requiredAttributes.ShouldHaveCount(3);
3333

3434
requiredAttributes.Should().Contain("nameOfCurrentFarm");

test/OpenApiTests/SchemaProperties/NullableReferenceTypesDisabled/ModelStateValidationEnabledTests.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ public ModelStateValidationEnabledTests(
1919
}
2020

2121
[Fact]
22-
public async Task Produces_expected_required_property_in_schema_for_resource()
22+
public async Task Produces_expected_required_property_set_in_schema_for_resource()
2323
{
2424
// Act
2525
JsonElement document = await _testContext.GetSwaggerDocumentAsync();
2626

2727
// Assert
28-
document.ShouldContainPath("components.schemas.chickenAttributesInPostRequest.required").With(requiredElement =>
28+
document.ShouldContainPath("components.schemas.chickenAttributesInPostRequest.required").With(propertySet =>
2929
{
30-
var requiredAttributes = JsonSerializer.Deserialize<List<string>>(requiredElement.GetRawText());
30+
var requiredAttributes = JsonSerializer.Deserialize<List<string>>(propertySet.GetRawText());
3131
requiredAttributes.ShouldHaveCount(3);
3232

3333
requiredAttributes.Should().Contain("nameOfCurrentFarm");

test/OpenApiTests/SchemaProperties/NullableReferenceTypesDisabled/NullabilityTests.cs

+13-13
Original file line numberDiff line numberDiff line change
@@ -25,36 +25,36 @@ public async Task Produces_expected_nullable_properties_in_schema_for_resource()
2525
JsonElement document = await _testContext.GetSwaggerDocumentAsync();
2626

2727
// Assert
28-
document.ShouldContainPath("components.schemas.chickenAttributesInResponse.properties").With(propertiesElement =>
28+
document.ShouldContainPath("components.schemas.chickenAttributesInResponse.properties").With(schemaProperties =>
2929
{
30-
propertiesElement.ShouldContainPath("name").With(propertyElement =>
30+
schemaProperties.ShouldContainPath("name").With(schemaProperty =>
3131
{
32-
propertyElement.ShouldContainPath("nullable").With(element => element.ValueKind.Should().Be(JsonValueKind.True));
32+
schemaProperty.ShouldContainPath("nullable").With(nullableProperty => nullableProperty.ValueKind.Should().Be(JsonValueKind.True));
3333
});
3434

35-
propertiesElement.ShouldContainPath("nameOfCurrentFarm").With(propertyElement =>
35+
schemaProperties.ShouldContainPath("nameOfCurrentFarm").With(schemaProperty =>
3636
{
37-
propertyElement.ShouldNotContainPath("nullable");
37+
schemaProperty.ShouldNotContainPath("nullable");
3838
});
3939

40-
propertiesElement.ShouldContainPath("age").With(propertyElement =>
40+
schemaProperties.ShouldContainPath("age").With(schemaProperty =>
4141
{
42-
propertyElement.ShouldNotContainPath("nullable");
42+
schemaProperty.ShouldNotContainPath("nullable");
4343
});
4444

45-
propertiesElement.ShouldContainPath("weight").With(propertyElement =>
45+
schemaProperties.ShouldContainPath("weight").With(schemaProperty =>
4646
{
47-
propertyElement.ShouldNotContainPath("nullable");
47+
schemaProperty.ShouldNotContainPath("nullable");
4848
});
4949

50-
propertiesElement.ShouldContainPath("timeAtCurrentFarmInDays").With(propertyElement =>
50+
schemaProperties.ShouldContainPath("timeAtCurrentFarmInDays").With(schemaProperty =>
5151
{
52-
propertyElement.ShouldContainPath("nullable").With(element => element.ValueKind.Should().Be(JsonValueKind.True));
52+
schemaProperty.ShouldContainPath("nullable").With(nullableProperty => nullableProperty.ValueKind.Should().Be(JsonValueKind.True));
5353
});
5454

55-
propertiesElement.ShouldContainPath("hasProducedEggs").With(propertyElement =>
55+
schemaProperties.ShouldContainPath("hasProducedEggs").With(schemaProperty =>
5656
{
57-
propertyElement.ShouldNotContainPath("nullable");
57+
schemaProperty.ShouldNotContainPath("nullable");
5858
});
5959
});
6060
}

test/OpenApiTests/SchemaProperties/NullableReferenceTypesEnabled/ModelStateValidationDisabledTests.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ public ModelStateValidationDisabledTests(
2020
}
2121

2222
[Fact]
23-
public async Task Produces_expected_required_property_in_schema_for_resource()
23+
public async Task Produces_expected_required_property_set_in_schema_for_resource()
2424
{
2525
// Act
2626
JsonElement document = await _testContext.GetSwaggerDocumentAsync();
2727

2828
// Assert
29-
document.ShouldContainPath("components.schemas.cowAttributesInPostRequest.required").With(requiredElement =>
29+
document.ShouldContainPath("components.schemas.cowAttributesInPostRequest.required").With(propertySet =>
3030
{
31-
var requiredAttributes = JsonSerializer.Deserialize<List<string>>(requiredElement.GetRawText());
31+
var requiredAttributes = JsonSerializer.Deserialize<List<string>>(propertySet.GetRawText());
3232
requiredAttributes.ShouldHaveCount(4);
3333

3434
requiredAttributes.Should().Contain("nameOfCurrentFarm");

test/OpenApiTests/SchemaProperties/NullableReferenceTypesEnabled/ModelStateValidationEnabledTests.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ public async Task Produces_expected_required_property_in_schema_for_resource()
2525
JsonElement document = await _testContext.GetSwaggerDocumentAsync();
2626

2727
// Assert
28-
document.ShouldContainPath("components.schemas.cowAttributesInPostRequest.required").With(requiredElement =>
28+
document.ShouldContainPath("components.schemas.cowAttributesInPostRequest.required").With(propertySet =>
2929
{
30-
var requiredAttributes = JsonSerializer.Deserialize<List<string>>(requiredElement.GetRawText());
30+
var requiredAttributes = JsonSerializer.Deserialize<List<string>>(propertySet.GetRawText());
3131
requiredAttributes.ShouldHaveCount(5);
3232

3333
requiredAttributes.Should().Contain("name");

test/OpenApiTests/SchemaProperties/NullableReferenceTypesEnabled/NullabilityTests.cs

+17-17
Original file line numberDiff line numberDiff line change
@@ -25,46 +25,46 @@ public async Task Produces_expected_nullable_properties_in_schema_for_resource()
2525
JsonElement document = await _testContext.GetSwaggerDocumentAsync();
2626

2727
// Assert
28-
document.ShouldContainPath("components.schemas.cowAttributesInResponse.properties").With(propertiesElement =>
28+
document.ShouldContainPath("components.schemas.cowAttributesInResponse.properties").With(schemaProperties =>
2929
{
30-
propertiesElement.ShouldContainPath("name").With(propertyElement =>
30+
schemaProperties.ShouldContainPath("name").With(schemaProperty =>
3131
{
32-
propertyElement.ShouldNotContainPath("nullable");
32+
schemaProperty.ShouldNotContainPath("nullable");
3333
});
3434

35-
propertiesElement.ShouldContainPath("nameOfCurrentFarm").With(propertyElement =>
35+
schemaProperties.ShouldContainPath("nameOfCurrentFarm").With(schemaProperty =>
3636
{
37-
propertyElement.ShouldNotContainPath("nullable");
37+
schemaProperty.ShouldNotContainPath("nullable");
3838
});
3939

40-
propertiesElement.ShouldContainPath("nameOfPreviousFarm").With(propertyElement =>
40+
schemaProperties.ShouldContainPath("nameOfPreviousFarm").With(schemaProperty =>
4141
{
42-
propertyElement.ShouldContainPath("nullable").With(element => element.ValueKind.Should().Be(JsonValueKind.True));
42+
schemaProperty.ShouldContainPath("nullable").With(element => element.ValueKind.Should().Be(JsonValueKind.True));
4343
});
4444

45-
propertiesElement.ShouldContainPath("nickname").With(propertyElement =>
45+
schemaProperties.ShouldContainPath("nickname").With(schemaProperty =>
4646
{
47-
propertyElement.ShouldNotContainPath("nullable");
47+
schemaProperty.ShouldNotContainPath("nullable");
4848
});
4949

50-
propertiesElement.ShouldContainPath("age").With(propertyElement =>
50+
schemaProperties.ShouldContainPath("age").With(schemaProperty =>
5151
{
52-
propertyElement.ShouldNotContainPath("nullable");
52+
schemaProperty.ShouldNotContainPath("nullable");
5353
});
5454

55-
propertiesElement.ShouldContainPath("weight").With(propertyElement =>
55+
schemaProperties.ShouldContainPath("weight").With(schemaProperty =>
5656
{
57-
propertyElement.ShouldNotContainPath("nullable");
57+
schemaProperty.ShouldNotContainPath("nullable");
5858
});
5959

60-
propertiesElement.ShouldContainPath("timeAtCurrentFarmInDays").With(propertyElement =>
60+
schemaProperties.ShouldContainPath("timeAtCurrentFarmInDays").With(schemaProperty =>
6161
{
62-
propertyElement.ShouldContainPath("nullable").With(element => element.ValueKind.Should().Be(JsonValueKind.True));
62+
schemaProperty.ShouldContainPath("nullable").With(element => element.ValueKind.Should().Be(JsonValueKind.True));
6363
});
6464

65-
propertiesElement.ShouldContainPath("hasProducedMilk").With(propertyElement =>
65+
schemaProperties.ShouldContainPath("hasProducedMilk").With(schemaProperty =>
6666
{
67-
propertyElement.ShouldNotContainPath("nullable");
67+
schemaProperty.ShouldNotContainPath("nullable");
6868
});
6969
});
7070
}

0 commit comments

Comments
 (0)