Mocking FileStream for integration testing
I made a simple integration test that tests some functionality after calling an API endpoint. In my api client, I have this function
As you can see, this function expects a string as an argument. To make the function testable though, I'd need an abstraction for FileStream (which I know exists as a NuGet package) and inject it into the function. The question is: Is that better? I know it doesn't sound too bad, but calling the function with a
. Or maybe you guys know another way to test such a function
UploadDocumentAsync(string filePath)As you can see, this function expects a string as an argument. To make the function testable though, I'd need an abstraction for FileStream (which I know exists as a NuGet package) and inject it into the function. The question is: Is that better? I know it doesn't sound too bad, but calling the function with a
FileStream instead of a string takes away a bit of comfort imo. I don't know if that's just silly
. Or maybe you guys know another way to test such a function