public void MSWWSP_S02_TC01_GetTemplatesForItem_TemplateData() { // Upload a file. string docItemUrl = this.UploadFileToSut(DocLibraryName); // If there are any existing task for new uploaded file, this method will throw an exception. this.VerifyTaskDataOfNewUploadFile(docItemUrl); // Call method GetTemplatesForItem to get a set of workflow associations for an existing document. GetTemplatesForItemResponseGetTemplatesForItemResult getTemplatesResult = ProtocolAdapter.GetTemplatesForItem(docItemUrl); if (getTemplatesResult == null) { this.Site.Assert.Fail("GetTemplatesForItem operation is failed."); } this.Site.Assume.IsNotNull(getTemplatesResult.TemplateData.WorkflowTemplates, "Could not get the WorkflowTemplates."); this.Site.Assume.IsTrue(getTemplatesResult.TemplateData.WorkflowTemplates.Length >= 1, "The length of the WorkflowTemplates is 0"); // If the GetTemplatesForItem operation is succeed, SUT return response then R150 should be covered. // Verify MS-WWSP requirement: MS-WWSP_R150 Site.CaptureRequirement( 150, @"[In GetTemplatesForItem] The protocol client sends a GetTemplatesForItemSoapIn request message, and the protocol server responds with a GetTemplatesForItemSoapOut response message."); // If the GetTemplatesForItem operation is succeed, SUT return TemplateDatas element in response, then R31, R147, R153, R162 and R408 should be covered. // Verify MS-WWSP requirement: MS-WWSP_R31 Site.CaptureRequirement( 31, @"[In Elements] TemplateData specifies a set of workflow associations."); // Verify MS-WWSP requirement: MS-WWSP_R147 Site.CaptureRequirement( 147, @"[In GetTemplatesForItem] This operation obtains a set of workflow associations for a new or existing document."); // Verify MS-WWSP requirement: MS-WWSP_R153 Site.CaptureRequirement( 153, @"[In Messages] GetTemplatesForItemSoapOut specifies the response to a request for a set of workflow associations for a new or existing document."); // Verify MS-WWSP requirement: MS-WWSP_R162 Site.CaptureRequirement( 162, @"[In Elements] GetTemplatesForItemResponse contains the response to a request for a set of workflow associations for a new or existing document."); // Verify MS-WWSP requirement: MS-WWSP_R408 Site.CaptureRequirement( 408, @"[In Message Processing Events and Sequencing Rules] GetTemplatesForItem obtains a set of workflow associations that can be started on a new or existing document in a specified list."); if (getTemplatesResult.TemplateData.Web.Title != null) { string currentWebTitle = SutController.GetCurrentWebTitle(); this.Site.Assume.IsNotNull(currentWebTitle, "Could not get the current web title."); // If the value of the Web.Title is equal to the specify value, then R384 should be covered. // Verify MS-WWSP requirement: MS-WWSP_R384 Site.CaptureRequirementIfAreEqual <string>( currentWebTitle, getTemplatesResult.TemplateData.Web.Title, 384, @"[In TemplateData] Web.Title: The title of the site for this set of workflow associations."); } if (getTemplatesResult.TemplateData.Web.Url != null) { string currentWebUrl = SutController.GetCurrentWebUrl().ToString(); this.Site.Assume.IsNotNull(currentWebUrl, "The current web URL is " + currentWebUrl); // If the value of the Web.URL is equal to the specify value, then R385 should be covered. // Verify MS-WWSP requirement: MS-WWSP_R385 Site.CaptureRequirementIfAreEqual <string>( currentWebUrl, getTemplatesResult.TemplateData.Web.Url, 385, @"[In TemplateData] Web.Url: A site URL for this set of workflow associations."); } if (getTemplatesResult.TemplateData.List.Title != null) { // If the value of the List.Title is equal to the specify value, then R386 should be covered. // Verify MS-WWSP requirement: MS-WWSP_R386 string titleUrlValueInResponse = getTemplatesResult.TemplateData.List.Title.ToLower(); string currentDocLibraryNameValue = DocLibraryName.ToLower(); Site.CaptureRequirementIfAreEqual <string>( currentDocLibraryNameValue, titleUrlValueInResponse, 386, @"[In TemplateData] List.Title: The title of the list for this set of workflow associations."); } if (getTemplatesResult.TemplateData.List.Url != null) { string listUrl = SutController.GetListUrlByName(DocLibraryName); this.Site.Assume.IsNotNull(listUrl, "The value of the List Url is" + listUrl); // If the value of the List.URL is equal to the specify value, then R387 should be covered. // Verify MS-WWSP requirement: MS-WWSP_R387 listUrl = listUrl.ToLower(); string urlValueInresponse = getTemplatesResult.TemplateData.List.Url.ToLower(); Site.CaptureRequirementIfAreEqual <string>( listUrl, urlValueInresponse, 387, @"[In TemplateData] List.Url: A list URL for this set of workflow associations."); } TemplateDataWorkflowTemplate templateItem = this.GetTemplateItemByName(getTemplatesResult.TemplateData.WorkflowTemplates, WorkflowAssociationName); // If the value of the TemplateId is equal to the specify value, then R389 should be covered. // Verify MS-WWSP requirement: MS-WWSP_R389 this.Site.Assert.IsNotNull( templateItem.WorkflowTemplateIdSet.TemplateId, "Could not get the template id for workflow association[{0}]", TestSuiteBase.WorkflowAssociationName); this.Site.CaptureRequirementIfAreEqual( new Guid(WorkflowAssociationId), templateItem.WorkflowTemplateIdSet.TemplateId, 389, @"[In TemplateData] WorkflowTemplates.WorkflowTemplate.WorkflowTemplateIdSet.TemplateId: A GUID identifying this workflow association."); // Get workflowassociation name string baseId = SutController.GetBaseIdOfWorkFlowAssociation(DocLibraryName, WorkflowAssociationName); this.Site.Assume.IsNotNull(baseId, "The value of the BaseId id " + baseId); // If the value of the BaseId is equal to the specify value, then R390 should be covered. // Verify MS-WWSP requirement: MS-WWSP_R390 this.Site.Assert.IsNotNull( templateItem.WorkflowTemplateIdSet.BaseId, "Could not get the BaseId for workflow association[{0}]", TestSuiteBase.WorkflowAssociationName); this.Site.CaptureRequirementIfAreEqual( new Guid(baseId), templateItem.WorkflowTemplateIdSet.BaseId, 390, @"[In TemplateData] WorkflowTemplates.WorkflowTemplate.WorkflowTemplateIdSet.BaseId: A GUID identifying the workflow template upon which this workflow association is based."); // If the value of the Name is equal to the specify value, then R391 should be covered. // Verify MS-WWSP requirement: MS-WWSP_R391 this.Site.Assert.IsFalse( string.IsNullOrEmpty(templateItem.Name), "Could not get the Name for workflow association[{0}]", TestSuiteBase.WorkflowAssociationName); string templateNameInResponse = templateItem.Name.ToLower(); string expectedName = WorkflowAssociationName.ToLower(); this.Site.CaptureRequirementIfAreEqual( expectedName, templateNameInResponse, 391, @"[In TemplateData] WorkflowTemplates.WorkflowTemplate.Name: The name of this workflow association."); // If the value of the Description is not null, then R392 should be covered. // Verify MS-WWSP requirement: MS-WWSP_R392 this.Site.CaptureRequirementIfIsNotNull( getTemplatesResult.TemplateData.WorkflowTemplates[0].Description, 392, @"[In TemplateData] WorkflowTemplates.WorkflowTemplate.Description: The description of this workflow association."); }