Skip to content

Commit 6979c17

Browse files
committed
Remove bidirectional tests because the feature has been removed
1 parent 366f8b8 commit 6979c17

File tree

1 file changed

+0
-57
lines changed

1 file changed

+0
-57
lines changed

src/Mvc/Mvc.ApiExplorer/test/EndpointMetadataApiDescriptionProviderTest.cs

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -407,63 +407,6 @@ public void AddsResponseDescription_WorksWithCollectionsAndTypedResults()
407407
Assert.Equal("application/json", createdOkFormat.MediaType);
408408
}
409409

410-
[Fact]
411-
public void AddsResponseDescription_WorksWithCollectionsWhereInnerTypeIsInEndpoint()
412-
{
413-
const string expectedOkDescription = "The weather forecast for the next 5 days.";
414-
415-
var apiDescription = GetApiDescription([ProducesResponseType<List<TimeSpan>>(StatusCodes.Status200OK, Description = expectedOkDescription)]
416-
() => new List<TimeSpan> { new() }.AsEnumerable());
417-
418-
var okResponseType = Assert.Single(apiDescription.SupportedResponseTypes);
419-
420-
Assert.Equal(200, okResponseType.StatusCode);
421-
Assert.Equal(typeof(IEnumerable<TimeSpan>), okResponseType.Type); // We use IEnumerable<TimeSpan> as the inferred type has higher priority than those set by metadata (attributes)
422-
Assert.Equal(typeof(IEnumerable<TimeSpan>), okResponseType.ModelMetadata?.ModelType);
423-
Assert.Equal(expectedOkDescription, okResponseType.Description);
424-
425-
var createdOkFormat = Assert.Single(okResponseType.ApiResponseFormats);
426-
Assert.Equal("application/json", createdOkFormat.MediaType);
427-
}
428-
429-
[Fact]
430-
public void AddsResponseDescription_WorksWithCollectionsAndTypedResultsWhereInnerTypeIsInEndpoint()
431-
{
432-
const string expectedOkDescription = "The weather forecast for the next 5 days.";
433-
434-
var apiDescription = GetApiDescription([ProducesResponseType<List<TimeSpan>>(StatusCodes.Status200OK, Description = expectedOkDescription)]
435-
() => TypedResults.Ok(new List<TimeSpan> { new() }.AsEnumerable()));
436-
437-
var okResponseType = Assert.Single(apiDescription.SupportedResponseTypes);
438-
439-
Assert.Equal(200, okResponseType.StatusCode);
440-
Assert.Equal(typeof(IEnumerable<TimeSpan>), okResponseType.Type); // We use IEnumerable<TimeSpan> as the inferred type has higher priority than those set by metadata (attributes)
441-
Assert.Equal(typeof(IEnumerable<TimeSpan>), okResponseType.ModelMetadata?.ModelType);
442-
Assert.Equal(expectedOkDescription, okResponseType.Description);
443-
444-
var createdOkFormat = Assert.Single(okResponseType.ApiResponseFormats);
445-
Assert.Equal("application/json", createdOkFormat.MediaType);
446-
}
447-
448-
[Fact]
449-
public void AddsResponseDescription_WorksWithCollectionsWhereInnerTypeIsInEndpointAndIsBaseClass()
450-
{
451-
const string expectedOkDescription = "The weather forecast for the next 5 days.";
452-
453-
var apiDescription = GetApiDescription([ProducesResponseType<List<GenericClass<string>>>(StatusCodes.Status200OK, Description = expectedOkDescription)]
454-
() => new List<BaseClass> { new() }.AsEnumerable());
455-
456-
var okResponseType = Assert.Single(apiDescription.SupportedResponseTypes);
457-
458-
Assert.Equal(200, okResponseType.StatusCode);
459-
Assert.Equal(typeof(IEnumerable<BaseClass>), okResponseType.Type); // We use IEnumerable<BaseClass> as the inferred type has higher priority than those set by metadata (attributes)
460-
Assert.Equal(typeof(IEnumerable<BaseClass>), okResponseType.ModelMetadata?.ModelType);
461-
Assert.Equal(expectedOkDescription, okResponseType.Description);
462-
463-
var createdOkFormat = Assert.Single(okResponseType.ApiResponseFormats);
464-
Assert.Equal("application/json", createdOkFormat.MediaType);
465-
}
466-
467410
/// <summary>
468411
/// EndpointMetadataApiDescriptionProvider performs a one way type check for discovering response types to match the description that's set in [ProducesResponseType]
469412
/// The reason we do a one-way check instead of a bidirectional check is to prevent too many positive matches.

0 commit comments

Comments
 (0)