Skip to content

RequestDelegateFactoryTests migration #47345

Closed
@mitchdenny

Description

@mitchdenny

As part of the implementation work for Request Delegate Generator (RDG) we want to make sure that we achieve the same test coverage as Request Delegate Factory (RDF). Below is a tick-box list of all the unit tests ([Fact] and [Theory]) in the RequestDelegateFactoryTests.cs source file that we need to evaluate for migration. As we work through these migrating them over to RequestDelegateCreationTests.cs we'll be improving out RDG test coverage and ensuring consistency between the RDG and RDF approaches.

Pending migration

  • RequestDelegateHandlesDoesNotHandleArraysFromQueryStringWhenBodyIsInferred
  • RequestDelegateHandlesOptionalArraysFromNullQueryString
  • RequestDelegateHandlesNullableStringValuesFromExplicitQueryStringSource
  • RequestDelegateHandlesNullableStringValuesFromExplicitQueryStringSourceForUnpresentedValues
  • RequestDelegateCanAwaitValueTasksThatAreNotImmediatelyCompleted
  • RequestDelegateThrowsForTryParsableFailuresIfThrowOnBadRequestWithNonOptionalArrays
  • RequestDelegateRejectsEmptyBodyGivenExplicitFromBodyParameter
  • Create_CombinesDefaultMetadata_AndMetadataFromReturnTypesImplementingIEndpointMetadataProvider
  • Create_CombinesDefaultMetadata_AndMetadataFromTaskWrappedReturnTypesImplementingIEndpointMetadataProvider
  • Create_CombinesDefaultMetadata_AndMetadataFromValueTaskWrappedReturnTypesImplementingIEndpointMetadataProvider
  • Create_CombinesDefaultMetadata_AndMetadataFromParameterTypesImplementingIEndpointParameterMetadataProvider
  • Create_CombinesDefaultMetadata_AndMetadataFromParameterTypesImplementingIEndpointMetadataProvider
  • Create_CombinesPropertiesAsParameterMetadata_AndTopLevelParameter
  • RequestDelegatePopulatesFromBodyParameter
  • RequestDelegateAllowsEmptyBodyStructGivenCorrectyConfiguredFromBodyParameter
  • RequestDelegateRequiresServiceForAllImplicitFromServiceParameters
  • RequestDelegateWithExplicitFromServiceParameters
  • RequestDelegatePopulatesParametersFromServiceWithAndWithoutAttribute
  • RequestDelegateUsesCustomIResult
  • RequestDelegateThrowsInvalidOperationExceptionOnNullDelegate
  • RequestDelegateHandlesRouteParamOptionality
  • RequestDelegateHandlesBindAsyncOptionality
  • RequestDelegateHandlesServiceParamOptionality
  • CanSetParseableStringParamAsOptionalWithNullabilityDisability
  • TreatsUnknownNullabilityAsOptionalForReferenceType
  • CanExecuteRequestDelegateWithResultsExtension
  • RequestDelegateCanProcessUriValues
  • RequestDelegatePopulatesFromParameterListRecordUsesDefaultValue
  • RequestDelegateFactory_AsParameters_SupportsNullableRequiredMember
  • RequestDelegateFactory_AsParameters_SupportsRequiredMember_NullabilityDisabled
  • BuildRequestDelegateThrowsArgumentNullExceptions
  • SpecifiedEmptyRouteParametersThrowIfRouteParameterDoesNotExist
  • CreateThrowsInvalidOperationExceptionWhenAttributeRequiresTryParseMethodThatDoesNotExist
  • CreateThrowsInvalidOperationExceptionGivenUnnamedArgument
  • RequestDelegateFactoryThrowsForByRefReturnTypes
  • BuildRequestDelegateThrowsInvalidOperationExceptionGivenFromBodyOnMultipleParameters
  • BuildRequestDelegateThrowsInvalidOperationExceptionForInvalidTryParse
  • BuildRequestDelegateThrowsInvalidOperationExceptionForInvalidBindAsync
  • BuildRequestDelegateThrowsInvalidOperationExceptionForInvalidParameterListConstructor
  • BuildRequestDelegateThrowsNotSupportedExceptionForNestedParametersList
  • BuildRequestDelegateThrowsNotSupportedExceptionForByRefParameters
  • CreateDelegateThrows_WhenGetJsonTypeInfoFail
  • BuildRequestDelegateThrowsInvalidOperationExceptionBodyAndFormParameters
  • CreateThrowsNotSupportedExceptionIfIFormFileCollectionHasMetadataParameterName
  • CreateThrowsNotSupportedExceptionIfIFormCollectionHasMetadataParameterName
  • RequestDelegateThrowsWhenNullableParameterList
  • RequestDelegateThrowsWhenParameterNameConflicts
  • Create_DoesNotAddDelegateMethodInfo_AsMetadata
  • RDF_CanAssertOnEmptyResult
  • Create_DoesNotAddAnythingBefore_ThePassedInEndpointMetadata
  • Create_DoesNotAddDelegateAttributes_AsMetadata

Already migrated

  • RequestDelegatePopulatesFromRouteParameterBasedOnParameterName (see: Move a few RDG tests across to shared infrastructure. #47347)
  • RequestDelegatePopulatesFromRouteParameterBased_FromParameterList
  • CreatingDelegateWithInstanceMethodInfoCreatesInstancePerCall (no migration: RDF specific test)
  • Returns400IfNoMatchingRouteValueForRequiredParam
  • RequestDelegatePopulatesUnattributedTryParsableParametersFromRouteValue (see: Move a few RDG tests across to shared infrastructure. #47347)
  • RequestDelegateHandlesArraysFromQueryString
  • RequestDelegateHandlesArraysFromExplicitQueryStringSource
  • RequestDelegateHandlesStringValuesFromExplicitQueryStringSource
  • RequestDelegateLogsStringValuesFromExplicitQueryStringSourceForUnpresentedValuesFailuresAsDebugAndSets400Response
  • RequestDelegateUsesTryParseOverBindAsyncGivenExplicitAttribute
  • RequestDelegateUsesBindAsyncFromImplementedInterface
  • RequestDelegateLogsTryParsableFailuresAsDebugAndSets400Response
  • RequestDelegateThrowsForTryParsableFailuresIfThrowOnBadRequest
  • RequestDelegateThrowsForTryParsableFailuresIfThrowOnBadRequestWithArrays
  • RequestDelegateLogsBindAsyncFailuresAndSets400Response
  • RequestDelegateThrowsForBindAsyncFailuresIfThrowOnBadRequest
  • RequestDelegateLogsSingleArgBindAsyncFailuresAndSets400Response
  • RequestDelegateThrowsForSingleArgBindAsyncFailuresIfThrowOnBadRequest
  • BindAsyncWithBodyArgument
  • BindAsyncRunsBeforeBodyBinding
  • RequestDelegatePopulatesFromQueryParameter_FromParameterList
  • RequestDelegatePopulatesFromHeaderParameter_FromParameterList
  • RequestDelegatePopulatesFromImplicitRawBodyParameter (Migrate some tests and fix fallback for empty optional bodies #47377)
  • RequestDelegatePopulatesFromExplicitRawBodyParameter (Migrate some tests and fix fallback for empty optional bodies #47377)
  • RequestDelegatePopulatesFromImplicitRawBodyParameterPipeReader (Migrate some tests and fix fallback for empty optional bodies #47377)
  • RequestDelegatePopulatesFromExplicitRawBodyParameterPipeReader (Migrate some tests and fix fallback for empty optional bodies #47377)
  • InferMetadata_ThenCreate_CombinesAllMetadata_InCorrectOrder
  • InferMetadata_PopulatesAcceptsMetadata_WhenReadFromForm
  • InferMetadata_PopulatesCachedContext #48630
  • Create_AllowsRemovalOfDefaultMetadata_ByReturnTypesImplementingIEndpointMetadataProvider
  • Create_AllowsRemovalOfDefaultMetadata_ByTaskWrappedReturnTypesImplementingIEndpointMetadataProvider
  • Create_AllowsRemovalOfDefaultMetadata_ByValueTaskWrappedReturnTypesImplementingIEndpointMetadataProvider
  • Create_AllowsRemovalOfDefaultMetadata_ByParameterTypesImplementingIEndpointParameterMetadataProvider
  • Create_AllowsRemovalOfDefaultMetadata_ByParameterTypesImplementingIEndpointMetadataProvider
  • Create_SetsApplicationServices_OnEndpointMetadataContext
  • Create_SetsApplicationServices_OnEndpointParameterMetadataContext
  • Create_DiscoversMetadata_FromParametersImplementingIEndpointParameterMetadataProvider
  • Create_DiscoversMetadata_FromParametersImplementingIEndpointMetadataProvider
  • Create_DiscoversEndpointMetadata_FromReturnTypeImplementingIEndpointMetadataProvider
  • Create_DiscoversEndpointMetadata_FromTaskWrappedReturnTypeImplementingIEndpointMetadataProvider
  • Create_DiscoversEndpointMetadata_FromValueTaskWrappedReturnTypeImplementingIEndpointMetadataProvider
  • RequestDelegateRejectsEmptyBodyGivenImplicitFromBodyParameter
  • RequestDelegateLogsIOExceptionsAsDebugDoesNotAbortAndNeverThrows
  • RequestDelegateLogsJsonExceptionsAsDebugAndSets400Response
  • RequestDelegateThrowsForJsonExceptionsIfThrowOnBadRequest
  • RequestDelegateLogsMalformedJsonAsDebugAndSets400Response
  • RequestDelegateThrowsForMalformedJsonIfThrowOnBadRequest
  • RequestDelegatePopulatesHttpContextParameterWithoutAttribute
  • RequestDelegatePopulatesHttpContextParameterWithoutAttribute_FromParameterList
  • RequestDelegatePassHttpContextRequestAbortedAsCancellationToken
  • RequestDelegatePassHttpContextUserAsClaimsPrincipal
  • RequestDelegatePassHttpContextUserAsClaimsPrincipal_FromParameterList
  • RequestDelegatePassHttpContextRequestAsHttpRequest
  • RequestDelegatePassHttpContextRequestAsHttpRequest_FromParameterList
  • RequestDelegatePassesHttpContextRresponseAsHttpResponse
  • RequestDelegatePassesHttpContextRresponseAsHttpResponse_FromParameterList
  • RequestDelegateWritesComplexReturnValueAsJsonResponseBody
  • RequestDelegateWritesComplexStructReturnValueAsJsonResponseBody
  • RequestDelegateWritesMembersFromChildTypesToJsonResponseBody
  • RequestDelegateWritesMembersFromChildTypesToJsonResponseBody_WithJsonPolymorphicOptions
  • RequestDelegateWritesMembersFromChildTypesToJsonResponseBody_WithJsonPolymorphicOptionsAndConfiguredJsonOptions
  • RequestDelegateWritesJsonTypeDiscriminatorToJsonResponseBody_WithJsonPolymorphicOptions
  • RequestDelegateWritesAsJsonResponseBody_WithJsonSerializerContext
  • RequestDelegateWritesStringReturnValueAndSetContentTypeWhenNull
  • RequestDelegateWritesStringReturnDoNotChangeContentType
  • RequestDelegateWritesIntReturnValue
  • RequestDelegateWritesBoolReturnValue
  • RequestDelegateWritesNullReturnNullValue
  • RequestDelegateHandlesQueryParamOptionality
  • RequestDelegateHandlesBodyParamOptionality
  • AllowEmptyOverridesOptionality
  • RequestDelegateRejectsNonJsonContent
  • RequestDelegateWithBindAndImplicitBodyRejectsNonJsonContent
  • RequestDelegateLogsIOExceptionsForFormAsDebugDoesNotAbortAndNeverThrows
  • RequestDelegateLogsMalformedFormAsDebugAndSets400Response
  • RequestDelegateThrowsForMalformedFormIfThrowOnBadRequest
  • RequestDelegatePopulatesFromIFormFileCollectionParameter
  • RequestDelegatePopulatesFromIFormFileCollectionParameterWithAttribute
  • RequestDelegatePopulatesFromIFormFileParameter
  • RequestDelegatePopulatesFromOptionalIFormFileParameter
  • RequestDelegatePopulatesFromMultipleRequiredIFormFileParameters
  • RequestDelegatePopulatesFromOptionalMissingIFormFileParameter
  • RequestDelegatePopulatesFromIFormFileParameterWithMetadata
  • RequestDelegatePopulatesFromIFormFileAndBoundParameter
  • RequestDelegateRejectsNonFormContent
  • RequestDelegateSets400ResponseIfRequiredFileNotSpecified
  • RequestDelegatePopulatesFromBothFormFileCollectionAndFormFileParameters
  • RequestDelegatePopulatesFromIFormFileParameterIfRequestContainsSecureHeader
  • RequestDelegatePopulatesFromIFormFileParameterIfRequestHasClientCertificate
  • RequestDelegatePopulatesFromIFormCollectionParameter
  • RequestDelegatePopulatesFromIFormCollectionParameterWithAttribute
  • RequestDelegatePopulatesFromOptionalFormParameter
  • RequestDelegatePopulatesFromMultipleRequiredFormParameters
  • RequestDelegatePopulatesFromOptionalMissingFormParameter
  • RequestDelegatePopulatesFromFormParameterWithMetadata
  • RequestDelegatePopulatesFromFormAndBoundParameter
  • RequestDelegatePopulatesFromBothIFormCollectionAndIFormFileParameters
  • RequestDelegateSets400ResponseIfRequiredFormItemNotSpecified
  • RequestDelegatePopulatesTryParsableParametersFromForm
  • RequestDelegatePopulatesFromParameterList
  • RequestDelegatePopulatesFromMultipleParameterLists
  • RequestDelegatePopulatesFromParameterListAndSkipReadOnlyProperties
  • RequestDelegatePopulatesFromParameterListUsesDefaultValue
  • RequestDelegateFactory_InvokesFiltersButNotHandler_OnArgumentError
  • RequestDelegateFactory_InvokesFilters_OnDelegateWithTarget
  • RequestDelegateFactory_CanInvokeSingleEndpointFilter_ThatProvidesCustomErrorMessage
  • RequestDelegateFactory_CanInvokeMultipleEndpointFilters_ThatTouchArguments
  • RequestDelegateFactory_CanInvokeEndpointFilter_ThatUsesMethodInfo
  • RequestDelegateFactory_CanInvokeEndpointFilter_ThatReadsEndpointMetadata
  • RequestDelegateFactory_CanInvokeSingleEndpointFilter_ThatModifiesBodyParameter
  • RequestDelegateFactory_CanInvokeSingleEndpointFilter_ThatModifiesResult
  • RequestDelegateFactory_CanInvokeMultipleEndpointFilters_ThatModifyArgumentsAndResult
  • CanInvokeFilter_OnTaskOfTReturningHandler
  • CanInvokeFilter_OnValueTaskOfTReturningHandler
  • CanInvokeFilter_OnVoidReturningHandler
  • CanInvokeFilter_OnHandlerReturningTasksOfStruct
  • RequestDelegateFactory_AsParameters_SupportsRequiredMember
  • Create_AddJsonResponseType_AsMetadata
  • Create_AddPlaintextResponseType_AsMetadata

Not being migrated

  • RequestDelegateInvokesAction (no migration: RDF specific test)
  • StaticMethodInfoOverloadWorksWithBasicReflection (no migration: RDF specific test)
  • NonStaticMethodInfoOverloadWorksWithBasicReflection (no migration: RDF specific test)
  • NullRouteParametersPrefersRouteOverQueryString (no migration: RDF specific test)
  • RequestDelegateFactory_InvokesFilters_OnMethodInfoWithNullTargetFactory (no migration: RDF specific test)
  • RequestDelegateFactory_InvokesFilters_OnMethodInfoWithProvidedTargetFactory (no migration: RDF specific test)
  • CanInvokeFilter_OnTaskModifyingHttpContext (Test doesn't touch code gen and hard to migrate to shared infra)
  • Create_CombinesAllMetadata_InCorrectOrder
  • Create_FlowsRoutePattern_ToMetadataProvider
  • Create_DoesNotInferMetadata_GivenManuallyConstructedMetadataResult
  • Create_ReturnsSameRequestDelegatePassedIn_IfNotModifiedByFilters (no migration: RDF specific test)
  • Create_Populates_EndpointBuilderWithRequestDelegateAndMetadata

Metadata

Metadata

Labels

area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-rdg

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions