-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Hi
I am trying to simulate a web service returning 4xx and 5xx by setting the context messages but the returned message does not have the WCF properties in the context. Do I missing something ?
For example:
`// ARRANGE
// Getting hold of the test messaging client instance
var testClient = _serviceMock.CreateMessagingClient(); // This is the only way to instantiate a TestMessagingClient.
// ACT
IDictionary<string, string> properties = new Dictionary<string, string>();
properties.Add(TransMock.Wcf.Adapter.Utils.BizTalkProperties.WCF.InboundHttpStatusCode, "401");
properties.Add(TransMock.Wcf.Adapter.Utils.BizTalkProperties.WCF.IsFault, "true");
Dictionary<string, string> messageProperties =
new Dictionary<string, string>(3);
Action<IDictionary<string, string>> messagePropertiesSetter = a => {
if (a == null)
{
a = new Dictionary<string, string>();
}
a.Clear();
foreach (KeyValuePair<string, string> pair in properties)
{
a.Add(pair.Key, pair.Value);
}
};
// Sending a message to a 2-way receive endpoint and expecting a synchronous response
testClient
.Send(
s => s.RL_Canonical,
requestFile: filename
)
.ReceiveRequestAndSendResponse(
s => s.SP_WebHttp_TW_BOSCH_InvoiceDraft_v1,
responseSelector: rs => new StaticFileResponseSelector { FilePath = responseFile },
messageEncoding: System.Text.Encoding.UTF8,
responsePropertiesSetter: messagePropertiesSetter,
timeoutInSeconds: 30,
requestValidator: v =>
{
Assert.True(v.Message.Body.Length > 0, "The response message is empty");
return true;
},
expectedMessageCount: 1,
afterResponseAction: a => a.DebugInfo($"Received file {a.MessageIndex}: {a.ToString()}")
);`
Metadata
Metadata
Assignees
Labels
No labels