I have an c# ashx handler that detects files attached. It works fine.
However, I am relying on third party company to write software to send files to handler (long story). I need to test that my handler works, time difference between us and 3rd party company is becoming a nightmare.
The scenario is 3rd party software sends files every 30 seconds to handler and I need to test this works and without sounding stupid I thought I ask stackoverflow 🙂
I just want to test my ashx handler using test unit or whatever but no idea where to start. Typing in “handler.ashx?filename=12345.csv” is helpful but no actual file attached!
Any suggestions would be great.
From what I understand, you have an ashx handler that you can upload files to and you want to test it.
I have attached a sample test that assumes an ashx handler that uses a POST request for file attachments.
Basically what you are doing is creating a WebRequest for POST and attaching the filestream to its request and filename to its query string.