Microsoft.Protocols.TestSuites.MS_SITESS.S01_MigrateSite.MSSITESS_S01_TC07_ImportingFailureOverwriteFailure C# (CSharp) Méthode

MSSITESS_S01_TC07_ImportingFailureOverwriteFailure() private méthode

private MSSITESS_S01_TC07_ImportingFailureOverwriteFailure ( ) : void
Résultat void
        public void MSSITESS_S01_TC07_ImportingFailureOverwriteFailure()
        {
            Site.Assume.IsTrue(Common.IsRequirementEnabled(5311, this.Site) && Common.IsRequirementEnabled(5391, this.Site), @"Test is executed only when R5311Enabled and R5391Enabled are set to true.");

            #region Variables
            string siteUrl = Common.GetConfigurationPropertyValue(Constants.SiteUrl, this.Site);
            string exportUrl = Common.GetConfigurationPropertyValue(Constants.NormalSubsiteUrl, this.Site);
            string importUrl = siteUrl + "/" + this.newSubsite;
            string anotherImportUrl = siteUrl + "/" + Common.GetConfigurationPropertyValue(Constants.NonExistentSiteName, this.Site);
            string dataPath = Common.GetConfigurationPropertyValue(Constants.DataPath, this.Site);
            string logPath = string.Empty;
            string exportJobName = Constants.ExportJobName + Common.FormatCurrentDateTime();
            string importJobName = Constants.ImportJobName + Common.FormatCurrentDateTime();
            string[] dataFiles = new string[] { dataPath + "/" + exportJobName + Constants.CmpExtension };
            int cabSize = 50;
            string[] exportWebFiles = null;
            string[] importWebFiles = null;
            int exportWebResult = 0;
            int importWebResult = 0;

            #endregion Variables

            // Initialize the web service with an authenticated account.
            this.sitessAdapter.InitializeWebService(UserAuthenticationOption.Authenticated);

            // Invoke the ExportWeb operation with valid dataPath, 1 is expected to be returned.
            exportWebResult = this.sitessAdapter.ExportWeb(exportJobName, exportUrl, dataPath, true, true, true, cabSize);

            #region Capture requirements

            // If 1 is returned, requirements related with ExportWeb pending can be verified.
            this.VerifyExportWebInProgress(exportWebResult);

            #endregion Capture requirements

            string files = TestSuiteHelper.VerifyExportAndImportFile(exportJobName, 2, this.Site, this.sutAdapter);
            exportWebFiles = files == null ? null : files.TrimEnd(new char[] { ';' }).Split(';');

            logPath = dataPath;

            // Invoke the ImportWeb operation with valid parameters, expect 1 is returned. The overwrite parameter is set to false to verify it doesn't mess anything up if no file to be overwrite.
            importWebResult = this.sitessAdapter.ImportWeb(importJobName, importUrl, dataFiles, logPath, true, false);

            #region Capture requirements

            // If 1 is returned, requirements related with ImportWeb pending can be verified.
            this.VerifyImportWebInProgress(importWebResult);

            #endregion Capture requirements

            files = TestSuiteHelper.VerifyExportAndImportFile(importJobName, 1, this.Site, this.sutAdapter);
            importWebFiles = files == null ? null : files.TrimEnd(new char[] { ';' }).Split(';');

            this.isWebImportedSuccessfully = true;

            // Invoke the ImportWeb operation with overwrite set to false, expect 11 is returned.
            importWebResult = this.sitessAdapter.ImportWeb(importJobName, anotherImportUrl, dataFiles, logPath, true, false);

            #region Capture requirements
            // If overwrite is set to false, R263 can be captured.
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-SITESS_R263");

            // Verify MS-SITESS requirement: MS-SITESS_R263
            Site.CaptureRequirementIfAreEqual<int>(
                11,
                importWebResult,
                263,
                @"[In ImportWeb] [overWrite:] The server MUST NOT overwrite existing files [at the location specified by logPath] with new files if false is specified.");

            // 11 will be returned if overwrite is set to false, so R393 can be captured.
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-SITESS_R393");

            // Verify MS-SITESS requirement: MS-SITESS_R393
            Site.CaptureRequirementIfAreEqual<int>(
                11,
                importWebResult,
                393,
                @"[In ImportWeb] [overWrite:] If the server cannot create a new file because this parameter is set to false, it MUST return error code 11 as specified in section 3.1.4.8.2.2.");
            #endregion Capture requirements

            #region Capture requirements

            // Verify that Microsoft Windows SharePoint Services 3.0 and above support operation ExportWeb.
            this.VerifyOperationExportWeb();

            // Verify that Microsoft Windows SharePoint Services 3.0 and above support operation ImportWeb.
            this.VerifyOperationImportWeb();

            #endregion Capture requirements
        }