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
}