Skip to content

Automated tests when using middleware validation #69

Discussion options

You must be logged in to vote

Same thing as you will instantiate new controller directly and pass to its method something... Invalid

That is because you want to test not only method itself, but full pipeline instead: mvc action filters, hotchocolate middleware, asp net core request middleware, masstransit events, etc

It is integration testing and some frameworks has testing support:
https://www.nuget.org/packages/Microsoft.AspNetCore.Mvc.Testing
https://www.nuget.org/packages/MassTransit.TestFramework/7.2.0-develop.65

HotChocolate also can execute full pipeline for integration testing. From parsing, procrssing to serializing response. Here is an example:

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@lindeberg
Comment options

@sergeyshaykhullin
Comment options

@sergeyshaykhullin
Comment options

@lindeberg
Comment options

@sergeyshaykhullin
Comment options

Answer selected by lindeberg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants