public void MSSITESS_S02_TC04_CreateWebFailureTemplateNotExist()
{
Site.Assume.IsTrue(Common.IsRequirementEnabled(3781, this.Site), @"Test is executed only when R3781Enabled is set to true.");
#region Variables
uint localeId = uint.Parse(Common.GetConfigurationPropertyValue(Constants.ValidLCID, this.Site));
Template[] templateList;
string webUrl = Common.GetConfigurationPropertyValue(Constants.SiteName, this.Site)
+ "/"
+ this.newSubsite;
string templateName = string.Empty;
uint getTemplateResult = 0;
bool isErrorOccured = false;
SoapException soapException = null;
#endregion Variables
// Initialize the web service with an authenticated account.
this.sitessAdapter.InitializeWebService(UserAuthenticationOption.Authenticated);
// Invoke the GetSiteTemplates operation with valid parameters, so result == 0 and templateList.Length > 1 are expected.
getTemplateResult = this.sitessAdapter.GetSiteTemplates(localeId, out templateList);
// GetTemplate operation should return more than one template.
Site.Assert.IsTrue(templateList.Length > 1, "GetTemplate operation should return more than one template.");
#region Capture requirements
this.VerifyResultOfGetSiteTemplate(getTemplateResult);
#endregion Capture requirements
// If 0 is returned and the templateList is not empty, it means the GetSiteTemplates operation is succeed.
// Try to invoke the CreateWeb operation with invalid templateName parameter.
try
{
// The first template is a Global template and can't be used to create web ,so templateList[1] is used here.
templateName = templateList[1].Name + "1";
this.sitessAdapter.CreateWeb(webUrl, Constants.WebTitle, Constants.WebDescription, templateName, localeId, true, localeId, true, localeId, true, true, true, true, true, true, true);
Site.Log.Add(LogEntryKind.Comment, "CreateWeb succeed!");
}
catch (SoapException ex)
{
soapException = ex;
isErrorOccured = true;
this.VerifySoapFaultDetail(ex);
}
#region Capture requirements
// When invoke the CreateWeb operation with invalid templateName parameter, if an ErrorCode 0x8102009f is thrown, it means the expected
// SOAP fault is thrown, so the following requirements can be captured.
string errorCode = Common.ExtractErrorCodeFromSoapFault(soapException);
this.VerifyErrorCodeOfCreateWeb(errorCode);
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-SITESS_R283, the error code is {0}", errorCode);
// Verify MS-SITESS requirement: MS-SITESS_R283
Site.CaptureRequirementIfIsTrue(
isErrorOccured && errorCode.Equals("0x8102009f"),
283,
@"[In CreateWeb] If the error code is 0x8102009f, it specifies the template specified by CreateWeb/templateName does not exist.");
this.VerifySoapFault(isErrorOccured);
// Verify that Microsoft SharePoint Foundation 2010 and above support operation CreateWeb.
this.VerifyOperationCreateWeb();
#endregion Capture requirements
}