Pact Net, как обеспечить тело ответа динамически?
Я пишу контрактное тестирование с использованием ядра nact pact-dotnet, в ядре dot net.
В потребительском тесте, как динамически указывать параметр body, я имею в виду, что хочу прочитать ожидаемый ответ из файла и вставить его. Например
**var expectedResponse = FileReader.GetJsonObject("GetCustomerResponse.json",
_environment);**
// Arrange
_mockProviderService.Given("There is data")
.UponReceiving("A valid GET request for get customer1")
.With(new ProviderServiceRequest
{
Method = HttpVerb.Get,
Path = "/customers/1234"
})
.WillRespondWith(new ProviderServiceResponse
{
Status = 200,
Headers = new Dictionary<string, object>
{
{ "Content-Type", "application/json; charset=utf-8" }
},
Body = **expectedResponse**
});
Спасибо!