public void MSFSSHTTP_FSSHTTPB_TestCase_S18_TC02_AmIAlone_Error() { // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); AmIAloneSubRequestType amIAlone = SharedTestSuiteHelper.CreateAmIAloneSubRequest(); CellStorageResponse response = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { amIAlone }); AmIAloneSubResponseType amIAloneResponse = SharedTestSuiteHelper.ExtractSubResponse <AmIAloneSubResponseType>(response, 0, 0, this.Site); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { //Verify MS-FSSHTTP requirement: MS-FSSHTTP_R22522 Site.CaptureRequirementIfAreNotEqual <string>( "Success", amIAloneResponse.ErrorCode, "MS-FSSHTTP", 22522, @"[In AmIAloneSubResponseType]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", amIAloneResponse.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 MSFSSHTTP_FSSHTTPB_TestCase_S18_TC01_AmIAlone_False() { // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); // Join Coauthoring session using the first user 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); // Join the Coauthoring session using the second user with same SchemaLockId this.InitializeContext(this.DefaultFileUrl, this.UserName02, this.Password02, this.Domain); string secondClientId = System.Guid.NewGuid().ToString(); subRequest = SharedTestSuiteHelper.CreateCoauthSubRequestForJoinCoauthSession(secondClientId, SharedTestSuiteHelper.ReservedSchemaLockID); cellResponse = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { subRequest }); CoauthSubResponseType secondResponse = SharedTestSuiteHelper.ExtractSubResponse <CoauthSubResponseType>(cellResponse, 0, 0, this.Site); this.StatusManager.RecordCoauthSession(this.DefaultFileUrl, secondClientId, SharedTestSuiteHelper.ReservedSchemaLockID, this.UserName02, this.Password02, this.Domain); string transitionId = secondResponse.SubResponseData.TransitionID; AmIAloneSubRequestType amIAlone = SharedTestSuiteHelper.CreateAmIAloneSubRequest(); amIAlone.SubRequestData.TransitionID = transitionId; CellStorageResponse response = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { amIAlone }); AmIAloneSubResponseType amIAloneResponse = SharedTestSuiteHelper.ExtractSubResponse <AmIAloneSubResponseType>(response, 0, 0, this.Site); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { //Verify MS-FSSHTTP requirement: MS-FSSHTTP_R224912 Site.CaptureRequirementIfAreEqual <string>( "False", amIAloneResponse.SubResponseData.AmIAlone, "MS-FSSHTTP", 224912, @"[In AmIAloneSubResponseDataType]AmIAlone: False means the user is not alone in the coauthoring session."); //Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2181012 //If MS-FSSHTTP224912 is verified, this requirement can be verified directly Site.CaptureRequirement( "MS-FSSHTTP", 2181012, @"[In SubResponseDataOptionalAttributes]AmIAlone: False means the user is not alone in the coauthoring session."); } else { Site.Assert.AreEqual <string>( "False", amIAloneResponse.SubResponseData.AmIAlone, "AmIAlone: False means the user is not alone in the coauthoring session."); } }
/// <summary> /// Capture requirements related with AmIAlone Sub-request. /// </summary> /// <param name="amIAloneSubResponse">Containing the AmIAloneSubResponse information</param> /// <param name="site">Instance of ITestSite</param> public static void ValidateAmIAloneSubResponse(AmIAloneSubResponseType amIAloneSubResponse, ITestSite site) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R22555 site.CaptureRequirement( "MS-FSSHTTP", 22555, @"[In AmIAloneSubResponseType] <xs:complexType name=""AmIAloneSubResponseType"" > < xs:complexContent > < xs:extension base = ""tns:SubResponseType"" > < xs:sequence minOccurs = ""0"" maxOccurs = ""1"" > < xs:element name = ""SubResponseData"" type = ""tns:AmIAloneSubResponseDataType"" /> </ xs:sequence > </ xs:extension > </ xs:complexContent > </ xs:complexType > "); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2256 site.CaptureRequirement( "MS-FSSHTTP", 2256, @"[In AmIAloneSubResponseType]SubResponseData: An AmIAloneSubResponseDataType that specifies the information about whether the user is alone that was requested as part of the AmIAlone subrequest."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2363 site.CaptureRequirementIfAreEqual <Type>( typeof(AmIAloneSubResponseType), amIAloneSubResponse.GetType(), "MS-FSSHTTP", 2363, @"[AmIAlone Subrequest]The protocol server responds with an AmIAlone SubResponse message, which is of type AmIAloneSubResponseType as specified in section 2.3.1.48. "); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2146 site.CaptureRequirementIfAreEqual <Type>( typeof(AmIAloneSubResponseType), amIAloneSubResponse.GetType(), "MS-FSSHTTP", 2146, @"[In SubResponseElementGenericType] Depending on the Type attribute specified in the SubRequest element, the SubResponseElementGenericType MUST take one of the forms: AmIAloneSubResponseType"); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2164 site.CaptureRequirementIfAreEqual <Type>( typeof(AmIAloneSubResponseType), amIAloneSubResponse.GetType(), "MS-FSSHTTP", 2164, @"[In SubResponseType] The SubResponseElementGenericType takes one of the following forms: AmIAloneSubResponseType."); ErrorCodeType errorCode; site.Assert.IsTrue(Enum.TryParse <ErrorCodeType>(amIAloneSubResponse.ErrorCode, true, out errorCode), "Fail to convert the error code string {0} to the Enum type ErrorCodeType", amIAloneSubResponse.ErrorCode); if (errorCode == ErrorCodeType.Success) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2158 site.CaptureRequirementIfIsNotNull( amIAloneSubResponse.SubResponseData, "MS-FSSHTTP", 2158, @"[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 ""AmIAlone""."); } // Verify requirements related with its base type: SubResponseType ValidateSubResponseType(amIAloneSubResponse as SubResponseType, site); // Verify requirements related with SubResponseDataType if (amIAloneSubResponse.SubResponseData != null) { ValidateAmIAloneSubResponseDataType(amIAloneSubResponse.SubResponseData, site); } }
public void TestCase_S18_TC01_AmIAlone_Success() { // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); // Join a Coauthoring session with time out value 3600. CoauthSubRequestType subRequest = SharedTestSuiteHelper.CreateCoauthSubRequestForJoinCoauthSession(SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.ReservedSchemaLockID, null, null, 3600); CellStorageResponse cellResponse = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { subRequest }); CoauthSubResponseType joinResponse = SharedTestSuiteHelper.ExtractSubResponse <CoauthSubResponseType>(cellResponse, 0, 0, this.Site); this.Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(joinResponse.ErrorCode, this.Site), "Test case cannot continue unless the user {0} using client id {1} and schema lock id {2} to join the coauthoring session succeed.", this.UserName01, SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.ReservedSchemaLockID); this.StatusManager.RecordCoauthSession(this.DefaultFileUrl, SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.ReservedSchemaLockID); string transitionId = joinResponse.SubResponseData.TransitionID; AmIAloneSubRequestType amIAlone = SharedTestSuiteHelper.CreateAmIAloneSubRequest(); amIAlone.SubRequestData.TransitionID = transitionId; CellStorageResponse response = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { amIAlone }); AmIAloneSubResponseType amIAloneResponse = SharedTestSuiteHelper.ExtractSubResponse <AmIAloneSubResponseType>(response, 0, 0, this.Site); SubResponseType subresponse = response.ResponseCollection.Response[0].SubResponse[0]; if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Capture the requirement MS-FSSHTTP_R246401 Site.CaptureRequirement( "MS-FSSHTTP", 246401, @"[In Appendix B: Product Behavior] Implementation does support AmIAlone operation. <60> (Microsoft SharePoint Foundation 2013/Microsoft SharePoint Server 2013 and above follow this behavior.)"); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R224911 Site.CaptureRequirementIfAreEqual <string>( "True", amIAloneResponse.SubResponseData.AmIAlone, "MS-FSSHTTP", 224911, @"[In AmIAloneSubResponseDataType]AmIAlone: True means the user is alone in the coauthoring session."); //Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2181011 //If MS-FSSHTTP224911 is verified, this requirement can be verified directly Site.CaptureRequirement( "MS-FSSHTTP", 2181011, @"[In SubResponseDataOptionalAttributes]AmIAlone: True means the user is alone in the coauthoring session."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2251 Site.CaptureRequirementIfAreEqual <string>( GenericErrorCodeTypes.Success.ToString(), subresponse.ErrorCode, "MS-FSSHTTP", 2251, @"[In AmIAloneSubResponseType]In the case of success, it contains information requested as part of an AmIAlone subrequest. "); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2374 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(subresponse.ErrorCode, this.Site), "MS-FSSHTTP", 2374, @"[AmIAlone Subrequest][The protocol returns results based on the following conditions]Otherwise, the protocol server sets the error code value to ""Success"" to indicate success in processing the AmIAlone subrequest."); } else { Site.Assert.AreEqual <string>( GenericErrorCodeTypes.Success.ToString(), subresponse.ErrorCode, "In the case of success, it contains information requested as part of an AmIAlone subrequest. "); } }