System.Net.Http.TestableMultipartStreamProviders contains a full rewrite of the standard multipart stream providers:
-
System.Net.Http.MultipartFileStreamProvider -> TestableMultipartFileStreamProvider
-
System.Net.Http.MultipartFormDataStreamProvider -> TestableMultipartFormDataStreamProvider
The downside of the standard classes is their hard coded reliance on the System.IO namespace, which makes them rather difficult to use in unit testing contexts. The testable replacements instead use the SystemWrapper library to allow developers to mock the filesystem operations.
System.Net.Http.TestableMultipartStreamProviders is available via NuGet. To install it, run the following command in the Package Manager Console:
PM> Install-Package System.Net.Http.TestableMultipartStreamProviders
Please see the wiki for usage and an example.