public void MSSITESS_S07_TC01_HttpStatusCodesFault()
{
#region Variables
uint lcid = uint.Parse(Common.GetConfigurationPropertyValue(Constants.ValidLCID, this.Site));
Template[] templates;
bool isExpectedHttpCode = false;
#endregion Variables
// Initialize the web service with an unauthenticated account.
this.sitessAdapter.InitializeWebService(UserAuthenticationOption.Unauthenticated);
// Try to invoke the GetSite operation, because the user is Unauthenticated, so a HTTP status code "Unauthorized" is expected to be thrown.
try
{
this.sitessAdapter.GetSiteTemplates(lcid, out templates);
}
catch (WebException exp)
{
if (exp.Response == null)
{
throw;
}
string strExp = ((HttpWebResponse)exp.Response).StatusCode.ToString();
Site.Assert.AreEqual<string>(
"Unauthorized",
strExp,
"Unauthorized error is expected to be returned.");
isExpectedHttpCode = true;
}
#region Capture requirements
// If expected HTTP Status Code is thrown, R365 can be captured.
Site.Log.Add(LogEntryKind.Debug, "Verify MS-SITESS_R365, the expected HTTP Status Code {0} thrown", isExpectedHttpCode ? "is" : "is not");
// Verify MS-SITESS requirement: MS-SITESS_R365
Site.CaptureRequirementIfIsTrue(
isExpectedHttpCode,
365,
@"[In Transport] Protocol server faults can be returned using HTTP Status Codes as specified in [RFC2616] section 10.");
#endregion Capture requirements
}