public void MSASHTTP_S03_TC03_SetPolicyKeyRequestHeader()
{
#region Change the query value type to PlainText.
// Call ConfigureRequestPrefixFields to set the QueryValueType to PlainText.
IDictionary<HTTPPOSTRequestPrefixField, string> requestPrefix = new Dictionary<HTTPPOSTRequestPrefixField, string>();
requestPrefix.Add(HTTPPOSTRequestPrefixField.QueryValueType, QueryValueType.PlainText.ToString());
this.HTTPAdapter.ConfigureRequestPrefixFields(requestPrefix);
#endregion
#region Call Provision command without setting X-MS-PolicyKey header.
SendStringResponse provisionResponse = this.CallProvisionCommand(string.Empty);
// Get the policy key from the response of Provision command.
string policyKey = TestSuiteHelper.GetPolicyKeyFromSendString(provisionResponse);
#endregion
#region Call Provision command with setting X-MS-PolicyKey header of the PlainText encoded query value type.
// Set the X-MS-PolicyKey header.
requestPrefix.Add(HTTPPOSTRequestPrefixField.PolicyKey, policyKey);
this.HTTPAdapter.ConfigureRequestPrefixFields(requestPrefix);
this.CallProvisionCommand(policyKey);
// Reset the X-MS-PolicyKey header.
requestPrefix[HTTPPOSTRequestPrefixField.PolicyKey] = string.Empty;
this.HTTPAdapter.ConfigureRequestPrefixFields(requestPrefix);
#endregion
#region Change the query value type to Base64.
// Call ConfigureRequestPrefixFields to set the QueryValueType to Base64.
requestPrefix[HTTPPOSTRequestPrefixField.QueryValueType] = QueryValueType.Base64.ToString();
this.HTTPAdapter.ConfigureRequestPrefixFields(requestPrefix);
#endregion
#region Call Provision command without setting Policy key field.
provisionResponse = this.CallProvisionCommand(string.Empty);
// Get the policy key from the response of Provision command.
policyKey = TestSuiteHelper.GetPolicyKeyFromSendString(provisionResponse);
#endregion
#region Call Provision command with setting Policy key field of the base64 encoded query value type.
// Set the Policy key field.
requestPrefix[HTTPPOSTRequestPrefixField.PolicyKey] = policyKey;
this.HTTPAdapter.ConfigureRequestPrefixFields(requestPrefix);
this.CallProvisionCommand(policyKey);
// Reset the Policy key field.
requestPrefix[HTTPPOSTRequestPrefixField.PolicyKey] = string.Empty;
this.HTTPAdapter.ConfigureRequestPrefixFields(requestPrefix);
#endregion
#region Reset the query value type.
requestPrefix[HTTPPOSTRequestPrefixField.QueryValueType] = Common.GetConfigurationPropertyValue("HeaderEncodingType", this.Site);
this.HTTPAdapter.ConfigureRequestPrefixFields(requestPrefix);
#endregion
}