public void MSWEBSS_S02_TC05_RemoveContentTypeXmlDocument_Unauthenticated()
{
string contentTypeID = CreateContentType(this.GenerateRandomString(10));
Adapter.InitializeService(UserAuthentication.Unauthenticated);
try
{
Adapter.RemoveContentTypeXmlDocument(contentTypeID, this.GenerateRandomString(10));
Site.Assert.Fail("The expected http status code is not returned for the RemoveContentTypeXmlDocument operation.");
}
catch (WebException exp)
{
if (exp.Response == null)
{
throw;
}
// Verify MS-WEBSS requirement: MS-WEBSS_R1082
// COMMENT: When the RemoveContentTypeXmlDocument operation is invoked by unauthenticated
// user, if the server return the expected http status code, then the requirement can be captured.
HttpWebResponse resp = exp.Response as HttpWebResponse;
Site.CaptureRequirementIfAreEqual<HttpStatusCode>(
HttpStatusCode.Unauthorized,
resp.StatusCode,
1082,
@"[In Message Processing Events and Sequencing Rules] If the user is not authorized to perform the operation[RemoveContentTypeXmlDocument], the protocol server MUST return an HTTP 401 error as specified in [RFC2616] section 10.4.");
}
}