public void MSSITESS_S02_TC03_CreateWebFailureUrlAlreadyInUse()
{
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);
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
// Try to invoke the CreateWeb operation with url parameter set to the web which is already used (i.e. Subsite1).
// The first template of the returned template list is a Global template and can't be used to create web ,so templateList[1] is used here.
try
{
this.sitessAdapter.CreateWeb(webUrl, Constants.WebTitle, Constants.WebDescription, templateList[1].Name, 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 url parameter set to the web which
// is already used (i.e. Subsite1), if an ErrorCode 0x800700b7 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);
// If the error code is 0x800700b7, R282 can be captured.
Site.Log.Add(LogEntryKind.Debug, "Verify MS-SITESS_R282, the error code is {0}", errorCode);
// Verify MS-SITESS requirement: MS-SITESS_R282
Site.CaptureRequirementIfIsTrue(
isErrorOccured && errorCode.Equals("0x800700b7"),
282,
@"[In CreateWeb] If the error code is 0x800700b7, it specifies the location specified by CreateWeb/url is already in use.");
this.VerifySoapFault(isErrorOccured);
// Verify that Microsoft SharePoint Foundation 2010 and above support operation CreateWeb.
this.VerifyOperationCreateWeb();
#endregion Capture requirements
}