This may be an interesting question. I need to check this if I can successfully download and extract the PDF file. This works for text files, but I just wanted to check the PDF. For this unit test to run, I need a PDF file. There are several options. I can create a dummy PDF file and save it in some folder and read this file and save the file in the system. But now my unit test depends on the PDF file. So anyone who runs unit test should have a PDF file which is bad.
Another way for me is to create a PDF file. This is not a big deal, as I can just create a dummy file with a .pdf extension. Or I can even use a third-party PDF tool to create a PDF file.
Another way is also to insert the PDF as an embedded resource and then extract it from the assembly.
What do you think is the best way to deal with this problem?
source
share