Skip to content

Commit

Permalink
Use Assert.Multiple
Browse files Browse the repository at this point in the history
Use xunit's `Assert.Multiple()` method to combine failed assertions together.
  • Loading branch information
martincostello committed Apr 23, 2024
1 parent a4a9bef commit f0fab28
Showing 1 changed file with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,18 +139,18 @@ public async Task TypesAreRenderedCorrectly()
var properties = weatherForecase.GetProperty("properties");
Assert.Equal(4, properties.EnumerateObject().Count());

Assert.Equal("string", properties.GetProperty("date").GetProperty("type").GetString());
Assert.Equal("date", properties.GetProperty("date").GetProperty("format").GetString());

Assert.Equal("integer", properties.GetProperty("temperatureC").GetProperty("type").GetString());
Assert.Equal("int32", properties.GetProperty("temperatureC").GetProperty("format").GetString());

Assert.Equal("string", properties.GetProperty("summary").GetProperty("type").GetString());
Assert.True(properties.GetProperty("summary").GetProperty("nullable").GetBoolean());

Assert.Equal("integer", properties.GetProperty("temperatureF").GetProperty("type").GetString());
Assert.Equal("int32", properties.GetProperty("temperatureF").GetProperty("format").GetString());
Assert.True(properties.GetProperty("temperatureF").GetProperty("readOnly").GetBoolean());
Assert.Multiple(
[
() => Assert.Equal("string", properties.GetProperty("date").GetProperty("type").GetString()),
() => Assert.Equal("date", properties.GetProperty("date").GetProperty("format").GetString()),
() => Assert.Equal("integer", properties.GetProperty("temperatureC").GetProperty("type").GetString()),
() => Assert.Equal("int32", properties.GetProperty("temperatureC").GetProperty("format").GetString()),
() => Assert.Equal("string", properties.GetProperty("summary").GetProperty("type").GetString()),
() => Assert.True(properties.GetProperty("summary").GetProperty("nullable").GetBoolean()),
() => Assert.Equal("integer", properties.GetProperty("temperatureF").GetProperty("type").GetString()),
() => Assert.Equal("int32", properties.GetProperty("temperatureF").GetProperty("format").GetString()),
() => Assert.True(properties.GetProperty("temperatureF").GetProperty("readOnly").GetBoolean()),
]);
}

private async Task SwaggerEndpointReturnsValidSwaggerJson<TEntryPoint>(string swaggerRequestUri)
Expand Down

0 comments on commit f0fab28

Please sign in to comment.