jeudi 19 mars 2020

How can I create a file within a test and convert it to a HttpContent object?

I am writing tests to test API responses. I need to test the response for a file upload to a .NET API.

So I need to pass a mock file through my post method as a HttpContent object. How can this be achieved? is there a way to create a file object within the test and convert it to the HttpContent object?

If it helps to know, I am using Xunit testing framework.

Aucun commentaire:

Enregistrer un commentaire