Overview on How to Unit Test Middleware?
I have a project where I am checking the value in a custom header and if its not there or if its missing pieces I would overwrite what was there.
Right now to test I make a blank .NET Core project and I add my middleware to the start up and I run it and then look at the headers to see if my header is there.
How would I even begin to turn this into a unit test? The only step I could see was from this blog where they use DefaultHttpContext() to develop an HTTPContext. I just don't know how I would go about applying the middleware I have in my startup.cs.
I just don't know if i need all that. I don't know enough behind the scenes of what goes on with middleware to know even a birds eye view of the steps I need to take to test this.
Any help would be appreciated!
0 comments:
Post a Comment