public void MSFSSHTTP_FSSHTTPB_TestCase_S19_TC02_LockStatus_Error() { // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); LockStatusSubRequestType lockStatus = SharedTestSuiteHelper.CreateLockStatusSubRequest(); CellStorageResponse response = this.Adapter.CellStorageRequest(null, new SubRequestType[] { lockStatus }); if (Common.IsRequirementEnabled(2273, this.Site)) { LockStatusSubResponseType lockStatusResponse = SharedTestSuiteHelper.ExtractSubResponse <LockStatusSubResponseType>(response, 0, 0, this.Site); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { //Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2273 Site.CaptureRequirementIfAreNotEqual <string>( "Success", lockStatusResponse.ErrorCode, "MS-FSSHTTP", 2273, @"[LockStatusSubResponseType]In the case of failure, the ErrorCode attribute that is part of a SubResponse element specifies the error code result for this subrequest. "); } else { Site.Assert.AreNotEqual <string>( "Success", lockStatusResponse.ErrorCode, "In the case of failure, the ErrorCode attribute that is part of a SubResponse element specifies the error code result for this subrequest. "); } } }
public void TestCase_S19_TC01_LockStatus_Success() { // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); CoauthSubRequestType subRequest = SharedTestSuiteHelper.CreateCoauthSubRequestForJoinCoauthSession(SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.ReservedSchemaLockID); CellStorageResponse cellResponse = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { subRequest }); CoauthSubResponseType subResponse = SharedTestSuiteHelper.ExtractSubResponse <CoauthSubResponseType>(cellResponse, 0, 0, this.Site); this.Site.Assert.AreEqual( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(subResponse.ErrorCode, this.Site), string.Format("Account {0} with client ID {1} and schema lock ID {2} should join the coauthoring session successfully.", this.UserName01, SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.ReservedSchemaLockID)); this.StatusManager.RecordCoauthSession(this.DefaultFileUrl, SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.ReservedSchemaLockID); LockStatusSubRequestType lockStatus = SharedTestSuiteHelper.CreateLockStatusSubRequest(); CellStorageResponse response = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { lockStatus }); LockStatusSubResponseType lockStatusResponse = SharedTestSuiteHelper.ExtractSubResponse <LockStatusSubResponseType>(response, 0, 0, this.Site); SubResponseType subresponse = response.ResponseCollection.Response[0].SubResponse[0]; if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Capture the requirement MS-FSSHTTP_R246601 Site.CaptureRequirement( "MS-FSSHTTP", 246601, @"[In Appendix B: Product Behavior] Implementation does support LockStatus operation. (SharePoint Server 2016 and above follow this behavior.)"); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2272 Site.CaptureRequirementIfAreEqual <string>( GenericErrorCodeTypes.Success.ToString(), subresponse.ErrorCode, "MS-FSSHTTP", 2272, @"[LockStatusSubResponseType]In the case of success, it contains information requested as part of a LockStatus subrequest. "); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R401011 Site.CaptureRequirementIfAreEqual <int>( 1, int.Parse(lockStatusResponse.SubResponseData.LockType), "MS-FSSHTTP", 401011, @"[In LockTypes] 1: The integer value ""1"", indicating a shared lock on the file."); } else { Site.Assert.AreEqual <string>( GenericErrorCodeTypes.Success.ToString(), subresponse.ErrorCode, "In the case of success, it contains information requested as part of a LockStatus subrequest. "); } }
public void MSFSSHTTP_FSSHTTPB_TestCase_S19_TC01_LockStatus_ExclusiveLock() { // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); // Disable the Coauthoring Feature bool isSwitchedSuccessfully = SutPowerShellAdapter.SwitchCoauthoringFeature(true); this.Site.Assert.IsTrue(isSwitchedSuccessfully, "The Coauthoring Feature should be disabled."); this.StatusManager.RecordDisableCoauth(); // Waiting change takes effect System.Threading.Thread.Sleep(30 * 1000); // Join a Coauthoring session CoauthSubRequestType subRequest = SharedTestSuiteHelper.CreateCoauthSubRequestForJoinCoauthSession(SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.ReservedSchemaLockID, true, SharedTestSuiteHelper.DefaultExclusiveLockID); CellStorageResponse cellResponse = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { subRequest }); CoauthSubResponseType subResponse = SharedTestSuiteHelper.ExtractSubResponse <CoauthSubResponseType>(cellResponse, 0, 0, this.Site); this.Site.Assert.AreEqual( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(subResponse.ErrorCode, this.Site), string.Format("Account {0} with client ID {1} and schema lock ID {2} should join the coauthoring session successfully.", this.UserName01, SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.DefaultExclusiveLockID)); this.StatusManager.RecordCoauthSession(this.DefaultFileUrl, SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.DefaultExclusiveLockID); LockStatusSubRequestType lockStatus = SharedTestSuiteHelper.CreateLockStatusSubRequest(); CellStorageResponse response = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { lockStatus }); LockStatusSubResponseType lockStatusResponse = SharedTestSuiteHelper.ExtractSubResponse <LockStatusSubResponseType>(response, 0, 0, this.Site); SubResponseType subresponse = response.ResponseCollection.Response[0].SubResponse[0]; if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R404011 Site.CaptureRequirementIfAreEqual <int>( 2, int.Parse(lockStatusResponse.SubResponseData.LockType), "MS-FSSHTTP", 404011, @"[In LockTypes] 2: The integer value ""2"", indicating an exclusive lock on the file."); } else { Site.Assert.AreEqual <int>( 2, int.Parse(lockStatusResponse.SubResponseData.LockType), @"2: The integer value ""2"", indicating an exclusive lock on the file."); } }
/// <summary> /// Capture requirements related with LockStatus Sub-request. /// </summary> /// <param name="lockStatusSubResponse">Containing the LockStatusSubResponse information</param> /// <param name="site">Instance of ITestSite</param> public static void ValidateLockStatusSubResponse(LockStatusSubResponseType lockStatusSubResponse, ITestSite site) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2276 site.CaptureRequirement( "MS-FSSHTTP", 2276, @"[LockStatusSubResponseType] <xs:complexType name=""LockStatusSubResponseType""> <xs:complexContent> <xs:extension base=""tns:SubResponseType""> <xs:sequence minOccurs=""0"" maxOccurs=""1""> <xs:element name=""SubResponseData"" type=""tns:LockStatusSubResponseDataType"" /> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType>" ); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2277 site.CaptureRequirement( "MS-FSSHTTP", 2277, @"[LockStatusSubResponseType]SubResponseData: A LockStatusSubResponseDataType that specifies the information about the lock status of a file that was requested as part of the LockStatus subrequest. "); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2377 site.CaptureRequirementIfAreEqual <Type>( typeof(LockStatusSubResponseType), lockStatusSubResponse.GetType(), "MS-FSSHTTP", 2377, @"[LockStatus Subrequest]The protocol server responds with a LockStatus SubResponse message, which is of type LockStatusSubResponseType as specified in section 2.3.1.51. "); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2147 site.CaptureRequirementIfAreEqual <Type>( typeof(LockStatusSubResponseType), lockStatusSubResponse.GetType(), "MS-FSSHTTP", 2147, @"[In SubResponseElementGenericType] Depending on the Type attribute specified in the SubRequest element, the SubResponseElementGenericType MUST take one of the forms: LockStatusSubResponseType"); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2165 site.CaptureRequirementIfAreEqual <Type>( typeof(LockStatusSubResponseType), lockStatusSubResponse.GetType(), "MS-FSSHTTP", 2165, @"[In SubResponseType] The SubResponseElementGenericType takes one of the following forms: LockStatusSubResponseType."); ErrorCodeType errorCode; site.Assert.IsTrue(Enum.TryParse <ErrorCodeType>(lockStatusSubResponse.ErrorCode, true, out errorCode), "Fail to convert the error code string {0} to the Enum type ErrorCodeType", lockStatusSubResponse.ErrorCode); if (errorCode == ErrorCodeType.Success) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2159 site.CaptureRequirementIfIsNotNull( lockStatusSubResponse.SubResponseData, "MS-FSSHTTP", 2159, @"[In SubResponseElementGenericType][The SubResponseData element MUST be sent as part of the SubResponse element in a cell storage service response message if the ErrorCode attribute that is part of the SubResponse element is set to a value of ""Success"" and one of the following conditions is true:] The Type attribute that is specified in the SubRequest element is set to a value of ""LockStatus""."); } // Verify requirements related with its base type: SubResponseType ValidateSubResponseType(lockStatusSubResponse as SubResponseType, site); // Verify requirements related with SubResponseDataType if (lockStatusSubResponse.SubResponseData != null) { ValidateLockStatusSubResponseDataType(lockStatusSubResponse.SubResponseData, site); } }