/// <summary> /// Get SUT version. /// </summary> /// <param name="site">An instance of interface ITestSite which provides logging, assertions, and adapters for test code onto its execution context.</param> /// <returns>Returns the SUT version.</returns> public static SutVersion GetSutVersion(ITestSite site) { string configuredSutVersion = GetConfigurationPropertyValue("SutVersion", site); SutVersion sutVersion = (SutVersion)Enum.Parse(typeof(SutVersion), configuredSutVersion, true); return(sutVersion); }
/// <summary> /// Merge the properties from the SHOULD/MAY ptfconfig file according to the supported products and specified protocol short name. /// </summary> /// <param name="supportedProducts">A parameter represents the all supported products.</param> /// <param name="supportedProductsRelatedRequirementId">A parameter represents the id of the requirement which specifies the supported products.</param> /// <param name="site">An instance of interface ITestSite which provides logging, assertions, and adapters for test code onto its execution context.</param> /// <param name="shortName">A parameter represents the current protocol short name. If this parameter is string.empty or null, this method will not use the parameter.</param> public static void MergeSHOULDMAYConfig(string[] supportedProducts, int supportedProductsRelatedRequirementId, ITestSite site, string shortName) { if (null == supportedProducts) { throw new ArgumentNullException("supportedProducts"); } if (supportedProductsRelatedRequirementId <= 0) { throw new ArgumentException("The value should be greater than Zero.", "supportedProductsRelatedRequirementId"); } SutVersion currentSutVersion = Common.GetConfigurationPropertyValue <SutVersion>("SutVersion", site); string currentSutVersionValue = currentSutVersion.ToString(); bool isCurrentSutSupported = supportedProducts.Any(supportedProduct => supportedProduct.Equals(currentSutVersionValue, StringComparison.OrdinalIgnoreCase)); string requirementPropertyName = string.Empty; string actualShortNameValue = string.Empty; if (string.IsNullOrEmpty(shortName)) { requirementPropertyName = string.Format("R{0}Enabled", supportedProductsRelatedRequirementId); actualShortNameValue = site.DefaultProtocolDocShortName; } else { requirementPropertyName = string.Format("R{0}Enabled_{1}", supportedProductsRelatedRequirementId, shortName); actualShortNameValue = shortName; } if (isCurrentSutSupported) { string shouldMayConfigFilename = string.Format("{0}_{1}_SHOULDMAY.deployment.ptfconfig", actualShortNameValue, currentSutVersionValue); Common.MergeConfigurationFile(shouldMayConfigFilename, site); site.Log.Add(LogEntryKind.Debug, "Use {0} file for optional requirements configuration", shouldMayConfigFilename); bool isExpectedPropertyExist = site.Properties.AllKeys.Any(property => property.Equals(requirementPropertyName, StringComparison.OrdinalIgnoreCase)); if (!isExpectedPropertyExist) { site.Assert.Fail("There should be a property [{0}].", requirementPropertyName); } } else { // If the current SUT version does not support the protocol, this method add a R***enable property into the properties collection. bool isExpectedPropertyExist = site.Properties.AllKeys.Any(property => property.Equals(requirementPropertyName, StringComparison.OrdinalIgnoreCase)); if (isExpectedPropertyExist) { site.Properties[requirementPropertyName] = bool.FalseString; } else { site.Properties.Add(requirementPropertyName, bool.FalseString); } } }
public void TestSuiteBaseInitialize() { Common.CheckCommonProperties(this.Site, true); // Check if MS-CPSWS service is supported in current SUT. if (!Common.GetConfigurationPropertyValue <bool>("MS-CPSWS_Supported", this.Site)) { SutVersion currentSutVersion = Common.GetConfigurationPropertyValue <SutVersion>("SutVersion", this.Site); this.Site.Assert.Inconclusive("This test suite does not supported under current SUT, because MS-CPSWS_Supported value set to false in MS-CPSWS_{0}_SHOULDMAY.deployment.ptfconfig file.", currentSutVersion); } }
public void TestCaseInitialize() { // Check if MS-SHDACCWS service is supported in current SUT. if (!Common.GetConfigurationPropertyValue <bool>("MS-SHDACCWS_Supported", this.Site)) { SutVersion currentSutVersion = Common.GetConfigurationPropertyValue <SutVersion>("SutVersion", this.Site); this.Site.Assert.Inconclusive("This test suite does not supported under current SUT, because MS-SHDACCWS_Supported value set to false in MS-SHDACCWS_{0}_SHOULDMAY.deployment.ptfconfig file.", currentSutVersion); } // Initialize the unique resource counter ListNameCounterOfPerTestCases = 0; FileNameCounterOfPerTestCases = 0; }
/// <summary> /// A method is used to check whether the SUT product supports the MS-WOPI protocol. If the SUT does not support, this method will raise an inconclusive assertion. /// </summary> /// <param name="site">A parameter represents the site.</param> public static void PerformSupportProductsCheck(ITestSite site) { TestSuiteHelper.CheckInputParameterNullOrEmpty <ITestSite>(site, "siteInstance", "PerformSupportProductsCheck"); if (!hasCheckSupportWOPI) { isCurrentSUTSupportWOPI = Common.GetConfigurationPropertyValue <bool>("MS-WOPI_Supported", site); hasCheckSupportWOPI = true; } if (!isCurrentSUTSupportWOPI) { SutVersion currentSutVersion = Common.GetConfigurationPropertyValue <SutVersion>("SutVersion", site); site.Assume.Inconclusive(@"The server does not support this specification [MS-WOPI]. It is determined by ""MS-WOPI_Supported"" SHOULDMAY property of the [{0}_{1}_SHOULDMAY.deployment.ptfconfig] configuration file.", WopiProtocolShortName, currentSutVersion); } }
public void TestCaseInitialize() { this.TestInitialize(); this.adapter = BaseTestSite.GetAdapter <IMS_WSSRESTAdapter>(); this.sutAdapter = BaseTestSite.GetAdapter <IMS_WSSRESTSUTControlAdapter>(); this.documentLibraryName = Common.GetConfigurationPropertyValue("DoucmentLibraryListName", this.Site); this.generalListName = Common.GetConfigurationPropertyValue("GeneralListName", this.Site); // Check if MS-WSSREST service is supported in current SUT. if (!Common.GetConfigurationPropertyValue <bool>("MS-WSSREST_Supported", this.Site)) { SutVersion currentSutVersion = Common.GetConfigurationPropertyValue <SutVersion>("SutVersion", this.Site); this.Site.Assert.Inconclusive("This test suite does not supported under current SUT, because MS-WSSREST_Supported value set to false in MS-WSSREST_{0}_SHOULDMAY.deployment.ptfconfig file.", currentSutVersion); } }
/// <summary> /// Initialize the ExchangeServiceBinding. /// </summary> /// <param name="exchangeServiceBinding">An ExchangeServiceBinding instance.</param> /// <param name="site">An instance of interface ITestSite which provides logging, assertions, and adapters for test code onto its execution context.</param> public static void InitializeServiceBinding(ExchangeServiceBinding exchangeServiceBinding, ITestSite site) { TransportProtocol transportType = (TransportProtocol)Enum.Parse(typeof(TransportProtocol), Common.GetConfigurationPropertyValue("TransportType", site), true); // Avoid closing base connection if (transportType == TransportProtocol.HTTPS) { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; Common.AcceptServerCertificate(); } exchangeServiceBinding.SoapVersion = SoapProtocolVersion.Soap11; SutVersion sutVersion = GetSutVersion(site); exchangeServiceBinding.RequestServerVersionValue = new RequestServerVersion(); switch (sutVersion) { case SutVersion.ExchangeServer2007: exchangeServiceBinding.RequestServerVersionValue.Version = ExchangeVersionType.Exchange2007_SP1; break; case SutVersion.ExchangeServer2010: exchangeServiceBinding.RequestServerVersionValue.Version = ExchangeVersionType.Exchange2010_SP2; break; case SutVersion.ExchangeServer2013: exchangeServiceBinding.RequestServerVersionValue.Version = ExchangeVersionType.Exchange2013; break; case SutVersion.ExchangeServer2016: exchangeServiceBinding.RequestServerVersionValue.Version = ExchangeVersionType.Exchange2016; break; case SutVersion.ExchangeServer2019: exchangeServiceBinding.RequestServerVersionValue.Version = ExchangeVersionType.Exchange2016; break; default: site.Assert.Fail(@"The SUT version ""{0}"" is invalid, the expected value is ""ExchangeServer2007"", ""ExchangeServer2010"", ""ExchangeServer2013"", ""ExchangeServer2016"" or ""ExchangeServer2019"".", sutVersion); break; } }
/// <summary> /// A method used to process unsupported Product behavior, it perform a directly capture for a requirement which describe an implementation does support products. /// </summary> /// <param name="testDocumentShortName">The value of the test document short name.</param> /// <param name="requirementId">The value of the test requirement id of which requirement describe an implementation does support products. </param> /// <param name="requirementDescription">The value of the test requirement description.</param> /// <param name="currentTestSite">An instance of the TestSite.</param> public static void ProcessingUnsupportProducts(string testDocumentShortName, int requirementId, string requirementDescription, ITestSite currentTestSite) { if (null == currentTestSite) { throw new ArgumentNullException("currentTestSite"); } if (Common.IsRequirementEnabled(testDocumentShortName, requirementId, currentTestSite)) { string documentShortName = string.Empty; // If the testDocumentShortName parameter do not have value, try to get from the DefaultProtocolDocShortName property of ITestSite instance. if (string.IsNullOrEmpty(testDocumentShortName)) { documentShortName = currentTestSite.DefaultProtocolDocShortName; } else { documentShortName = testDocumentShortName; } if (string.IsNullOrEmpty(documentShortName)) { currentTestSite.CaptureRequirement(requirementId, requirementDescription); } else { currentTestSite.CaptureRequirement(documentShortName, requirementId, requirementDescription); } } else { SutVersion currentSutVersion = Common.GetConfigurationPropertyValue <SutVersion>("SutVersion", currentTestSite); currentTestSite.Assert.Inconclusive("This test suite does not support current SUT version[{0}].", currentSutVersion); } }
public void MSFSSHTTP_FSSHTTPBTestInitialize() { if (!isPerformMergeOperation) { this.MergeConfigurationFile(this.Site); isPerformMergeOperation = true; } // If the shared test code are executed in MS-WOPI mode, try to verify whether run in support products by check the MS-WOPI_Supported property of MS-WOPI. if ("MS-WOPI".Equals(this.Site.DefaultProtocolDocShortName, System.StringComparison.OrdinalIgnoreCase)) { if (!Common.GetConfigurationPropertyValue <bool>("MS-WOPI_Supported", this.Site)) { SutVersion currentSutVersion = Common.GetConfigurationPropertyValue <SutVersion>("SutVersion", this.Site); this.Site.Assume.Inconclusive(@"The server does not support this specification [MS-WOPI]. It is determined by ""MS-WOPI_Supported"" SHOULDMAY property of the [{0}_{1}_SHOULDMAY.deployment.ptfconfig] configuration file.", this.Site.DefaultProtocolDocShortName, currentSutVersion); } } this.UserName01 = Common.GetConfigurationPropertyValue("UserName1", this.Site); this.Password01 = Common.GetConfigurationPropertyValue("Password1", this.Site); this.UserName02 = Common.GetConfigurationPropertyValue("UserName2", this.Site); this.Password02 = Common.GetConfigurationPropertyValue("Password2", this.Site); this.UserName03 = Common.GetConfigurationPropertyValue("UserName3", this.Site); this.Password03 = Common.GetConfigurationPropertyValue("Password3", this.Site); this.Domain = Common.GetConfigurationPropertyValue("Domain", this.Site); // Initialize the web service using the configured UserName/Domain and password. this.Adapter = Site.GetAdapter <IMS_FSSHTTP_FSSHTTPBAdapter>(); // Initialize the SUT Control Adapter instance this.SutPowerShellAdapter = Site.GetAdapter <IMS_FSSHTTP_FSSHTTPBSUTControlAdapter>(); this.SutManagedAdapter = Site.GetAdapter <IMS_FSSHTTP_FSSHTTPBManagedCodeSUTControlAdapter>(); // Initialize the file status manager to handle the environment clean up. this.StatusManager = new StatusManager(this.Site, this.InitializeContext); }
public void MSOXWSCORE_S07_TC16_GetTaskItemWithTwoItemIdTypesSuccessfully() { #region Step 1: Create a recurring task item. // Define the pattern and range of the recurring task item. DailyRecurrencePatternType pattern = new DailyRecurrencePatternType(); pattern.Interval = 1; NumberedRecurrenceRangeType range = new NumberedRecurrenceRangeType(); int numberOfOccurrences = 5; range.NumberOfOccurrences = numberOfOccurrences; System.DateTime start = System.DateTime.Now; range.StartDate = start; // Define the TaskType item. TaskType[] items = new TaskType[] { new TaskType() }; items[0].Subject = Common.GenerateResourceName( this.Site, TestSuiteHelper.SubjectForCreateItem); items[0].Recurrence = new TaskRecurrenceType(); items[0].Recurrence.Item = pattern; items[0].Recurrence.Item1 = range; // Call CreateItem operation. CreateItemResponseType createItemResponse = this.CallCreateItemOperation(DistinguishedFolderIdNameType.tasks, items); // Check the operation response. Common.CheckOperationSuccess(createItemResponse, 1, this.Site); BaseItemIdType[] createdTaskItemIds = Common.GetItemIdsFromInfoResponse(createItemResponse); // One created task item should be returned. Site.Assert.AreEqual <int>( 1, createdTaskItemIds.GetLength(0), "One created task item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, createdTaskItemIds.GetLength(0)); #endregion #region Step 2: Get the recurring task item by ItemIdType. // Call GetItem operation using the created task item ID. GetItemResponseType getItemResponse = this.CallGetItemOperation(createdTaskItemIds); // Check the operation response. Common.CheckOperationSuccess(getItemResponse, 1, this.Site); #endregion // Exchange 2007 and Exchange 2010 do not support the RecurringMasterItemIdRanges element. SutVersion currentSutVersion = (SutVersion)Enum.Parse(typeof(SutVersion), Common.GetConfigurationPropertyValue("SutVersion", this.Site)); if (currentSutVersion.Equals(SutVersion.ExchangeServer2013)) { #region Step 3: Get the recurring task item by RecurringMasterItemIdRangesType. // Define the RecurringMasterItemIdRanges using the created task item ID. RecurringMasterItemIdRangesType[] recurringMasterItemIdRanges = new RecurringMasterItemIdRangesType[1]; recurringMasterItemIdRanges[0] = new RecurringMasterItemIdRangesType(); recurringMasterItemIdRanges[0].Id = (createdTaskItemIds[0] as ItemIdType).Id; recurringMasterItemIdRanges[0].ChangeKey = (createdTaskItemIds[0] as ItemIdType).ChangeKey; recurringMasterItemIdRanges[0].Ranges = new OccurrencesRangeType[1]; recurringMasterItemIdRanges[0].Ranges[0] = new OccurrencesRangeType(); recurringMasterItemIdRanges[0].Ranges[0].CompareOriginalStartTimeSpecified = true; recurringMasterItemIdRanges[0].Ranges[0].CompareOriginalStartTime = true; recurringMasterItemIdRanges[0].Ranges[0].StartSpecified = true; recurringMasterItemIdRanges[0].Ranges[0].Start = start; recurringMasterItemIdRanges[0].Ranges[0].EndSpecified = true; recurringMasterItemIdRanges[0].Ranges[0].End = start.AddDays(numberOfOccurrences); // Call GetItem operation using the recurringMasterItemIdRanges. getItemResponse = this.CallGetItemOperation(recurringMasterItemIdRanges); // Check the operation response. Common.CheckOperationSuccess(getItemResponse, 1, this.Site); #endregion } }
public void TestSuiteBaseInitialization() { Common.CheckCommonProperties(this.Site, true); // Check if MS-WWSP service is supported in current SUT. if (!Common.GetConfigurationPropertyValue <bool>("MS-WWSP_Supported", this.Site)) { SutVersion currentSutVersion = Common.GetConfigurationPropertyValue <SutVersion>("SutVersion", this.Site); this.Site.Assert.Inconclusive("This test suite does not supported under current SUT, because MS-WWSP_Supported value set to false in MS-WWSP_{0}_SHOULDMAY.deployment.ptfconfig file.", currentSutVersion); } // Initialize the variables if (string.IsNullOrEmpty(CurrentProtocolPerformAccountName)) { CurrentProtocolPerformAccountName = Common.GetConfigurationPropertyValue("MSWWSPTestAccount", TestSuiteBase.BaseTestSite); BaseTestSite.Assert.IsFalse( string.IsNullOrEmpty(CurrentProtocolPerformAccountName), @"The [MSWWSPTestAccount] property in [MS-WWSP_TestSuite.deployment.ptfconfig] file should have value."); } if (string.IsNullOrEmpty(DocLibraryName)) { DocLibraryName = Common.GetConfigurationPropertyValue("CurrentDocLibraryListName", TestSuiteBase.BaseTestSite); this.Site.Assert.IsFalse( string.IsNullOrEmpty(DocLibraryName), "The [CurrentDocLibraryListName] property in [MS-WWSP_TestSuite.deployment.ptfconfig] file should have value."); } if (string.IsNullOrEmpty(TaskListName)) { TaskListName = Common.GetConfigurationPropertyValue("CurrentTaskListName", TestSuiteBase.BaseTestSite); this.Site.Assert.IsFalse( string.IsNullOrEmpty(TaskListName), "The [CurrentTaskListName] property in [MS-WWSP_TestSuite.deployment.ptfconfig] file should have value."); } if (string.IsNullOrEmpty(WorkflowAssociationName)) { WorkflowAssociationName = Common.GetConfigurationPropertyValue("WorkflowAssociationName", TestSuiteBase.BaseTestSite); this.Site.Assert.IsFalse( string.IsNullOrEmpty(WorkflowAssociationName), "The [WorkflowAssociationName] property in [MS-WWSP_TestSuite.deployment.ptfconfig] file should have value."); } if (string.IsNullOrEmpty(DocListId)) { DocListId = SutController.GetListIdByName(DocLibraryName); this.Site.Assert.IsFalse( string.IsNullOrEmpty(DocListId), @"Should get the valid list id of the Document Library type list[""{0}""]", DocLibraryName); } if (string.IsNullOrEmpty(TaskListId)) { TaskListId = SutController.GetListIdByName(TaskListName); this.Site.Assert.IsFalse( string.IsNullOrEmpty(TaskListId), @"Should get the valid list id of the Task type list[""{0}""]", TaskListName); } if (string.IsNullOrEmpty(WorkflowAssociationId)) { WorkflowAssociationId = SutController.GetWorkflowAssociationIdByName(DocLibraryName, WorkflowAssociationName); this.Site.Assert.IsFalse( string.IsNullOrEmpty(WorkflowAssociationId), @"Should get the valid id of workflow Association[{0}] in the Document Library type list[""{1}""]", WorkflowAssociationName, DocLibraryName); } }
/// <summary> /// Initialize the Test suite. /// </summary> protected override void TestInitialize() { base.TestInitialize(); this.BTRFAdapter = Site.GetAdapter <IMS_OXWSBTRFAdapter>(); // If implementation doesn't support this specification [MS-OXWSBTRF] as specified in section 8, the case will not start. if (!bool.Parse(Common.GetConfigurationPropertyValue("MS-OXWSBTRF_Supported", this.Site))) { SutVersion currentSutVersion = (SutVersion)Enum.Parse(typeof(SutVersion), Common.GetConfigurationPropertyValue("SutVersion", this.Site)); this.Site.Assert.Inconclusive("This test suite is not supported under current SUT, because MS-OXWSBTRF_Supported value is set to false in MS-OXWSBTRF_{0}_SHOULDMAY.deployment.ptfconfig file.", currentSutVersion); } else { this.FOLDAdapter = Site.GetAdapter <IMS_OXWSFOLDAdapter>(); this.COREAdapter = Site.GetAdapter <IMS_OXWSCOREAdapter>(); this.BTRFSUTControlAdapter = Site.GetAdapter <IMS_OXWSBTRFSUTControlAdapter>(); // Add four folder types to ParentFolderType list. this.ParentFolderType = new Collection <DistinguishedFolderIdNameType>() { DistinguishedFolderIdNameType.inbox, DistinguishedFolderIdNameType.calendar, DistinguishedFolderIdNameType.contacts, DistinguishedFolderIdNameType.tasks }; // Initialize the OriginalFolderId collection to store the folder ids that items will be exported from and uploaded to this.OriginalFolderId = new Collection <string>(); for (int i = 0; i < this.ParentFolderType.Count; i++) { // Generate the folder name. string folderName = Common.GenerateResourceName(this.Site, this.ParentFolderType[i] + "OriginalFolder"); // Create a sub folder in the specified parent folder. string folderId = this.CreateSubFolder(this.ParentFolderType[i], folderName); // Add the new created sub folder's id to OriginalFolderId collection. this.OriginalFolderId.Add(folderId); Site.Assert.IsNotNull( this.OriginalFolderId[i], string.Format( "The sub folder named '{0}' in folder '{1}' should be created successfully.", folderName, this.ParentFolderType[i].ToString())); } // Initialize the CreatedItemSubject list to store all created item subjects. this.CreatedItemSubject = new Collection <string>(); // Initialize CreatedItemId list to store all created item ids. this.CreatedItemId = new Collection <ItemIdType>(); // Create an ItemIdType array to store the created items' ids. ItemIdType[] itemIds = new ItemIdType[this.OriginalFolderId.Count]; for (int i = 0; i < itemIds.Length; i++) { // Generate the item subject. string itemSubject = Common.GenerateResourceName(this.Site, this.ParentFolderType[i] + "Item"); // Create items in the created sub folders. itemIds[i] = this.CreateItem(this.ParentFolderType[i], this.OriginalFolderId[i], itemSubject); Site.Assert.IsNotNull(itemIds[i], string.Format("The item with subject '{0}' should be created successfully!", itemSubject)); // If the item id is not empty, add it to the CreatedItemId list. this.CreatedItemId.Add(itemIds[i]); // Add the Subject to the CreatedItemSubject list. this.CreatedItemSubject.Add(itemSubject); } this.ItemCount = this.CreatedItemId.Count; ExchangeServiceBinding.ServiceResponseEvent += new ExchangeServiceBinding.ServiceResponseDelegate(this.ExchangeServiceBinding_ResponseEvent); } }