The class provides the methods to assist MS-SITESSAdapter.
        public void MSSITESS_S05_TC01_ExportWorkflowTemplateSucceed()
        {
            Site.Assume.IsTrue(Common.IsRequirementEnabled(5331, this.Site), @"Test is executed only when R5331Enabled is set to true.");

            #region Variables
            string   templateName   = Common.GetConfigurationPropertyValue(Constants.WorkflowTemplateName, this.Site);
            string   destinationUrl = Common.GetConfigurationPropertyValue(Constants.DataPath, this.Site);
            string   exportResult   = string.Empty;
            string[] exportFiles    = null;
            string[] expectedFiles  = null;

            #endregion Variables

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

            // Invoke ExportWorkflowTemplate operation, a URL is expected to be returned and a solution file is expected to be exported.
            exportResult = this.sitessAdapter.ExportWorkflowTemplate(this.solutionName + Constants.WspExtension, Constants.SolutionTitle, Constants.SolutionDescription, templateName, destinationUrl);

            // If returned value is not a URL or exported files are inconsistent with the expected, log it.
            Site.Assert.IsTrue(
                Uri.IsWellFormedUriString(exportResult, UriKind.Relative),
                "ExportWorkflowTemplate should return a valid Uri, actual uri {0}.",
                exportResult);

            string solutions = TestSuiteHelper.VerifyExportAndImportFile(this.solutionName, 1, this.Site, this.sutAdapter);
            exportFiles = solutions == null ? null : solutions.TrimEnd(new char[] { ';' }).Split(';');
            this.isSolutionFileCreated = true;

            // Format the expected file names in the document library, only one solution file (i.e. SolutionName) is expected.
            expectedFiles = new string[] { this.solutionName + Constants.WspExtension };

            Site.Assert.IsTrue(
                AdapterHelper.CompareStringArrays(expectedFiles, exportFiles),
                "ExportWorkflowTemplate should export the solution file.");

            // If returned value is a URL and exported files are consistent with the expected, it means the ExportWorkflowTemplate operation succeed.
            // Invoke ExportWorkflowTemplate operation again, a URL is expected to be returned and a second solution file is expected to be exported.
            exportResult = this.sitessAdapter.ExportWorkflowTemplate(this.solutionName + Constants.WspExtension, Constants.SolutionTitle, Constants.SolutionDescription, templateName, destinationUrl);

            // If returned value is not a URL or exported files are inconsistent with the expected, log it.
            Site.Assert.IsTrue(
                Uri.IsWellFormedUriString(exportResult, UriKind.Relative),
                "ExportWorkflowTemplate should return a valid Uri, actual uri {0}.",
                exportResult);

            solutions   = TestSuiteHelper.VerifyExportAndImportFile(this.solutionName, 2, this.Site, this.sutAdapter);
            exportFiles = solutions == null ? null : solutions.TrimEnd(new char[] { ';' }).Split(';');

            // Format the expected file names in the document library, two solution files (i.e. SolutionName & SolutionName2) are expected.
            expectedFiles = new string[]
            {
                this.solutionName + Constants.WspExtension,
                this.solutionName + "2" + Constants.WspExtension
            };

            #region Capture requirements

            bool isFilesAreEqual = AdapterHelper.CompareStringArrays(expectedFiles, exportFiles);

            // If the exported files are consistent with the expected, R386 can be captured.
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-SITESS_R386, the export files are {0}", exportFiles);

            // Verify MS-SITESS requirement: MS-SITESS_R386
            Site.CaptureRequirementIfIsTrue(
                isFilesAreEqual,
                386,
                @"[In ExportWorkflowTemplate] [solutionFileName:] If a solution with the specified name already exists in the document library in which the solution file needs to be created, the server MUST retry with <filename>2.wsp, where <filename> is obtained from solutionFileName after excluding the extension.");

            // If the exported files are consistent with the expected, R109 can be captured.
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-SITESS_R109, the export files are {0}", exportFiles);

            // Verify MS-SITESS requirement: MS-SITESS_R109
            Site.CaptureRequirementIfIsTrue(
                isFilesAreEqual,
                109,
                @"[In ExportWorkflowTemplate] [solutionFileName:] If a unique name is obtained, the protocol server MUST continue with that name [to create a solution file using this unique name].");

            // If code can run to here, it means that Microsoft SharePoint Foundation 2010 and above support operation ExportWorkflowTemplate.
            this.VerifyOperationExportWorkflowTemplate();
            #endregion Capture requirements
        }
예제 #2
0
        public void MSSITESS_S06_TC01_GetSiteSucceed()
        {
            Site.Assume.IsTrue(Common.IsRequirementEnabled(5341, this.Site), @"Test is executed only when R5341Enabled is set to true.");

            #region Variables
            string url                     = Common.GetConfigurationPropertyValue(Constants.NormalSubsiteUrl, this.Site);
            string getResult               = string.Empty;
            Guid   expectedGuid            = Guid.Empty;
            bool   expectedUserCodeEnabled = false;
            Site   result;
            Guid   siteGuid            = Guid.Empty;
            bool   siteUserCodeEnabled = false;

            #endregion Variables

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

            // Get the site collection identifier of the site collection.
            expectedGuid = new Guid(this.sutAdapter.GetSiteGuid());

            Site.Assert.AreNotEqual <Guid>(
                Guid.Empty,
                expectedGuid,
                "Site's guid should not be null.");

            // Set whether user code is enabled for the site collection. Set user code is true.
            expectedUserCodeEnabled = this.sutAdapter.SetUserCodeEnabled(true);
            Site.Assert.IsTrue(expectedUserCodeEnabled, "The user code should be enabled for the site collection.");

            // Invoke the GetSite operation with valid SiteUrl.
            // getResult is in form: <Site Url=UrlString Id=IdString UserCodeEnabled=UserCodeEnabledString />.
            // If split getResult with '"', the fourth is IdString. And, the sixth is UserCodeEnabledString.
            getResult = this.sitessAdapter.GetSite(url);

            Site.Assert.IsNotNull(getResult, "The GetSiteResult should not be null when invoking the GetSite operation with valid SiteUrl");
            result = AdapterHelper.SiteResultDeserialize(getResult);

            // Get the Id element form result of the succeed GetSite operation.
            siteGuid = new Guid(result.Id);

            // Get the UserCodeEnabled element form result of the succeed GetSite operation.
            bool convertResult = bool.TryParse(result.UserCodeEnabled, out siteUserCodeEnabled);

            #region Capture requirements

            this.VerifyIdString(expectedGuid, siteGuid);

            if (convertResult)
            {
                // The value for UserCodeEnabledString MUST be ""true"" if user code is enabled for the site collection.
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-SITESS_R398");

                // Verify MS-SITESS requirement: MS-SITESS_R398
                Site.CaptureRequirementIfAreEqual <bool>(
                    expectedUserCodeEnabled,
                    siteUserCodeEnabled,
                    398,
                    @"[In GetSiteResponse] [GetSiteResult:] The value for UserCodeEnabledString MUST be ""true"" if user code is enabled for the site collection.");
            }
            else
            {
                Site.Assert.Fail("The returned value of the UserCodeEnabled element is not of type bool, the value is : {0}", result.UserCodeEnabled);
            }

            #endregion Capture requirements

            // Set whether user code is enabled for the site collection. Set user code is false.
            expectedUserCodeEnabled = this.sutAdapter.SetUserCodeEnabled(false);
            Site.Assert.IsFalse(expectedUserCodeEnabled, "The user code should not be enabled for the site collection.");

            // Invoke the GetSite operation with valid SiteUrl.
            // getResult is in form: <Site Url=UrlString Id=IdString UserCodeEnabled=UserCodeEnabledString />.
            // If split getResult with '"', the fourth is IdString. And, the sixth is UserCodeEnabledString.
            getResult = this.sitessAdapter.GetSite(url);

            Site.Assert.IsNotNull(getResult, "The GetSiteResult should not be null when invoking the GetSite operation with valid SiteUrl");
            result = AdapterHelper.SiteResultDeserialize(getResult);

            // Get the Id element form result of the succeed GetSite operation.
            siteGuid = new Guid(result.Id);

            // Get the UserCodeEnabled element form result of the succeed GetSite operation.
            convertResult = bool.TryParse(result.UserCodeEnabled, out siteUserCodeEnabled);

            #region Capture requirements

            this.VerifyIdString(expectedGuid, siteGuid);

            if (convertResult)
            {
                // The value for UserCodeEnabledString MUST be ""false"" if user code is not enabled for the site collection.
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-SITESS_R399");

                // Verify MS-SITESS requirement: MS-SITESS_R399
                Site.CaptureRequirementIfAreEqual <bool>(
                    expectedUserCodeEnabled,
                    siteUserCodeEnabled,
                    399,
                    @"[In GetSiteResponse] [GetSiteResult:] The value for UserCodeEnabledString MUST be ""false"" if it is not enabled.");
            }
            else
            {
                Site.Assert.Fail("The returned value of the UserCodeEnabled element is not of type bool, the value is : {0}", result.UserCodeEnabled);
            }

            if (Common.IsRequirementEnabled(326001002, this.Site))
            {
                string[] urls  = new string[] { result.Url };
                bool[]   urlss = this.sitessAdapter.IsScriptSafeUrl(urls);

                // If IsScriptSafeUrl is false, it indicates the url is not a valid script safe url.
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-SITESS_R32602702");

                // Verify MS-SITESS requirement: MS-SITESS_R32602702
                Site.CaptureRequirementIfIsFalse(
                    urlss[0],
                    32602702,
                    @"[InArrayOfBoolean]  boolean: [False] Indicates a URL is not a valid script safe URL for the current site.");

                // If urls is a file full path or URL, R422003 can be captured.
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-SITESS_R422003");

                Uri  fileLocation;
                bool isUrl = Uri.TryCreate(urls[0], UriKind.Absolute, out fileLocation);

                // Verify MS-SITESS requirement: MS-SITESS_R422003
                Site.CaptureRequirementIfIsTrue(
                    isUrl,
                    422003,
                    @"[In ArrayOfString] string: A file full path or URL.");
            }
            #endregion Capture requirements

            // If code can run to here, it means that Microsoft SharePoint Foundation 2010 and above support operation GetSite.
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-SITESS_R5341, Microsoft SharePoint Foundation 2010 and above support operation GetSite.");

            // Verify MS-SITESS requirement: MS-SITESS_R5341
            Site.CaptureRequirement(
                5341,
                @"[In Appendix B: Product Behavior] Implementation does support this method [GetSite]. (Microsoft SharePoint Foundation 2010 and above follow this behavior.)");
        }