public void Can_send_ResponseStream_test_with_Custom_Header()
{
var mockResponse = new HttpResponseMock();
var customText = "<h1>Custom Stream</h1>";
var customTextBytes = customText.ToUtf8Bytes();
var ms = new MemoryStream();
ms.Write(customTextBytes, 0, customTextBytes.Length);
var httpResult = new HttpResult(ms, ContentType.Html)
{
Headers =
{
{"X-Custom","Header"}
}
};
var reponseWasAutoHandled = mockResponse.WriteToResponse(httpResult, ContentType.Html);
Assert.That(reponseWasAutoHandled, Is.True);
var writtenString = mockResponse.GetOutputStreamAsString();
Assert.That(writtenString, Is.EqualTo(customText));
Assert.That(mockResponse.Headers["X-Custom"], Is.EqualTo("Header"));
}