diff options
author | Stephen Halter <halter73@gmail.com> | 2022-09-15 00:24:12 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-15 00:24:12 +0300 |
commit | 26d284ae36f769970f75b19bdfedd75c92bf813b (patch) | |
tree | f8209cc54c4064b4f3b080509e95ea86331cd851 /src/Http | |
parent | 21716e1556b932341242abbafde9041bc8ba9e21 (diff) |
Continue using `typeof(void)` for empty results (#43990)
Diffstat (limited to 'src/Http')
10 files changed, 12 insertions, 1 deletions
diff --git a/src/Http/Http.Results/test/AcceptedAtRouteResultTests.cs b/src/Http/Http.Results/test/AcceptedAtRouteResultTests.cs index cf11ba325d..8e7f3124ab 100644 --- a/src/Http/Http.Results/test/AcceptedAtRouteResultTests.cs +++ b/src/Http/Http.Results/test/AcceptedAtRouteResultTests.cs @@ -85,6 +85,7 @@ public class AcceptedAtRouteResultTests // Assert var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last(); Assert.Equal(StatusCodes.Status202Accepted, producesResponseTypeMetadata.StatusCode); + Assert.Equal(typeof(void), producesResponseTypeMetadata.Type); } [Fact] diff --git a/src/Http/Http.Results/test/AcceptedResultTests.cs b/src/Http/Http.Results/test/AcceptedResultTests.cs index 0e17089db4..b2dd17f6cd 100644 --- a/src/Http/Http.Results/test/AcceptedResultTests.cs +++ b/src/Http/Http.Results/test/AcceptedResultTests.cs @@ -41,7 +41,9 @@ public class AcceptedResultTests PopulateMetadata<Accepted>(((Delegate)MyApi).GetMethodInfo(), builder); // Assert - Assert.Contains(builder.Metadata, m => m is ProducesResponseTypeMetadata { StatusCode: StatusCodes.Status202Accepted }); + var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last(); + Assert.Equal(StatusCodes.Status202Accepted, producesResponseTypeMetadata.StatusCode); + Assert.Equal(typeof(void), producesResponseTypeMetadata.Type); } [Fact] diff --git a/src/Http/Http.Results/test/BadRequestResultTests.cs b/src/Http/Http.Results/test/BadRequestResultTests.cs index 3555def21b..bbbefff4fc 100644 --- a/src/Http/Http.Results/test/BadRequestResultTests.cs +++ b/src/Http/Http.Results/test/BadRequestResultTests.cs @@ -56,6 +56,7 @@ public class BadRequestResultTests // Assert var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last(); Assert.Equal(StatusCodes.Status400BadRequest, producesResponseTypeMetadata.StatusCode); + Assert.Equal(typeof(void), producesResponseTypeMetadata.Type); } [Fact] diff --git a/src/Http/Http.Results/test/ConflictResultTests.cs b/src/Http/Http.Results/test/ConflictResultTests.cs index c6919e9ac6..cae52b92d8 100644 --- a/src/Http/Http.Results/test/ConflictResultTests.cs +++ b/src/Http/Http.Results/test/ConflictResultTests.cs @@ -57,6 +57,7 @@ public class ConflictResultTests // Assert var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last(); Assert.Equal(StatusCodes.Status409Conflict, producesResponseTypeMetadata.StatusCode); + Assert.Equal(typeof(void), producesResponseTypeMetadata.Type); } [Fact] diff --git a/src/Http/Http.Results/test/CreatedAtRouteResultTests.cs b/src/Http/Http.Results/test/CreatedAtRouteResultTests.cs index cfb42575e8..72daa7f28a 100644 --- a/src/Http/Http.Results/test/CreatedAtRouteResultTests.cs +++ b/src/Http/Http.Results/test/CreatedAtRouteResultTests.cs @@ -81,6 +81,7 @@ public partial class CreatedAtRouteResultTests // Assert var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last(); Assert.Equal(StatusCodes.Status201Created, producesResponseTypeMetadata.StatusCode); + Assert.Equal(typeof(void), producesResponseTypeMetadata.Type); } [Fact] diff --git a/src/Http/Http.Results/test/CreatedResultTests.cs b/src/Http/Http.Results/test/CreatedResultTests.cs index 4a62a238b5..c5c94d4e80 100644 --- a/src/Http/Http.Results/test/CreatedResultTests.cs +++ b/src/Http/Http.Results/test/CreatedResultTests.cs @@ -74,6 +74,7 @@ public class CreatedResultTests // Assert var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last(); Assert.Equal(StatusCodes.Status201Created, producesResponseTypeMetadata.StatusCode); + Assert.Equal(typeof(void), producesResponseTypeMetadata.Type); } [Fact] diff --git a/src/Http/Http.Results/test/NoContentResultTests.cs b/src/Http/Http.Results/test/NoContentResultTests.cs index be210eae40..4a589b905d 100644 --- a/src/Http/Http.Results/test/NoContentResultTests.cs +++ b/src/Http/Http.Results/test/NoContentResultTests.cs @@ -53,6 +53,7 @@ public class NoContentResultTests // Assert var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last(); Assert.Equal(StatusCodes.Status204NoContent, producesResponseTypeMetadata.StatusCode); + Assert.Equal(typeof(void), producesResponseTypeMetadata.Type); } [Fact] diff --git a/src/Http/Http.Results/test/NotFoundResultTests.cs b/src/Http/Http.Results/test/NotFoundResultTests.cs index d6c3c90479..15538d3419 100644 --- a/src/Http/Http.Results/test/NotFoundResultTests.cs +++ b/src/Http/Http.Results/test/NotFoundResultTests.cs @@ -52,6 +52,7 @@ public class NotFoundResultTests // Assert var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last(); Assert.Equal(StatusCodes.Status404NotFound, producesResponseTypeMetadata.StatusCode); + Assert.Equal(typeof(void), producesResponseTypeMetadata.Type); } [Fact] diff --git a/src/Http/Http.Results/test/OkResultTests.cs b/src/Http/Http.Results/test/OkResultTests.cs index f8c341e441..a57226ccd8 100644 --- a/src/Http/Http.Results/test/OkResultTests.cs +++ b/src/Http/Http.Results/test/OkResultTests.cs @@ -56,6 +56,7 @@ public class OkResultTests // Assert var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last(); Assert.Equal(StatusCodes.Status200OK, producesResponseTypeMetadata.StatusCode); + Assert.Equal(typeof(void), producesResponseTypeMetadata.Type); } [Fact] diff --git a/src/Http/Http.Results/test/UnprocessableEntityResultTests.cs b/src/Http/Http.Results/test/UnprocessableEntityResultTests.cs index d49b172da0..412edb8bed 100644 --- a/src/Http/Http.Results/test/UnprocessableEntityResultTests.cs +++ b/src/Http/Http.Results/test/UnprocessableEntityResultTests.cs @@ -56,6 +56,7 @@ public class UnprocessableEntityResultTests // Assert var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last(); Assert.Equal(StatusCodes.Status422UnprocessableEntity, producesResponseTypeMetadata.StatusCode); + Assert.Equal(typeof(void), producesResponseTypeMetadata.Type); } [Fact] |