Microsoft.Protocols.TestSuites.SharedTestSuite.S07_EditorsTable.TestCase_S07_TC01_EditorsTable_JoinEditSession C# (CSharp) Method

TestCase_S07_TC01_EditorsTable_JoinEditSession() private method

private TestCase_S07_TC01_EditorsTable_JoinEditSession ( ) : void
return void
        public void TestCase_S07_TC01_EditorsTable_JoinEditSession()
        {
            if (!Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 9001, this.Site))
            {
                Site.Assume.Inconclusive("The implementation does not support EditorsTable. It is determined using PTFConfig property named R9001Enabled_MS-FSSHTTP-FSSHTTPB.");
            }

            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            // Call protocol adapter operation CellStorageRequest using user01 to join the editing session.
            EditorsTableSubRequestType join = SharedTestSuiteHelper.CreateEditorsTableSubRequestForJoinSession(System.Guid.NewGuid().ToString(), 3600);
            CellStorageResponse cellStorageResponseJoin = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { join });
            EditorsTableSubResponseType subResponseJoin = SharedTestSuiteHelper.ExtractSubResponse<EditorsTableSubResponseType>(cellStorageResponseJoin, 0, 0, this.Site);
            string firstClientId = join.SubRequestData.ClientID;

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // If the ErrorCode attribute is not null, MS-FSSHTTP_R1969 could be covered.
                this.Site.Log.Add(
                    LogEntryKind.Debug,
                    "For MS-FSSHTTP_R1969, the ErrorCode attribute should be returned by the protocol server, actually it is {0}.",
                    subResponseJoin.ErrorCode == null ? "not returned" : "returned");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1969
                Site.CaptureRequirementIfIsNotNull(
                         subResponseJoin.ErrorCode,
                         "MS-FSSHTTP",
                         1969,
                         @"[In EditorsTable Subrequest] The protocol server returns results based on the following conditions: 
                         Depending on the type of error, the ErrorCode is returned as an attribute of the SubResponse element.");

                // If the ErrorCode attribute returned equals "Success", then MS-FSSHTTP_R1771 and MS-FSSHTTP_R1961 could be covered.
                Site.CaptureRequirementIfAreEqual<ErrorCodeType>(
                         ErrorCodeType.Success,
                         SharedTestSuiteHelper.ConvertToErrorCodeType(subResponseJoin.ErrorCode, this.Site),
                         "MS-FSSHTTP",
                         1771,
                         @"[In EditorsTableSubResponseType][ErrorCode] The protocol server sets the value of the ErrorCode attribute to ""Success"" if the protocol server succeeds in processing the editors table subrequest.");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1961
                Site.CaptureRequirementIfAreEqual<ErrorCodeType>(
                         ErrorCodeType.Success,
                         SharedTestSuiteHelper.ConvertToErrorCodeType(subResponseJoin.ErrorCode, this.Site),
                         "MS-FSSHTTP",
                         1961,
                         @"[In EditorsTable Subrequest][The protocol client sends an editors table SubRequest message, which is of type EditorsTableSubRequestType] The protocol server responds with an editors table SubResponse message, which is of type EditorsTableSubResponseType as specified in section 2.3.1.25.");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1979
                Site.CaptureRequirementIfAreEqual<ErrorCodeType>(
                         ErrorCodeType.Success,
                         SharedTestSuiteHelper.ConvertToErrorCodeType(subResponseJoin.ErrorCode, this.Site),
                         "MS-FSSHTTP",
                         1979,
                         @"[In EditorsTable Subrequest][The protocol server returns results based on the following conditions:] The protocol server returns an error code value set to ""Success"" to indicate success in processing the EditorsTable request.");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R3081
                Site.CaptureRequirementIfIsNotNull(
                         subResponseJoin.SubResponseData,
                         "MS-FSSHTTP",
                         3081,
                         @"[In EditorsTableSubResponseType] As part of processing the editors table subrequest, the SubResponseData element MUST be sent as part of the SubResponse element in a cell storage service response message if the following condition is true: The ErrorCode attribute that is part of the SubResponse element is set to a value of ""Success"".");
            }
            else
            {
                Site.Assert.IsNotNull(
                    subResponseJoin.ErrorCode,
                    @"[In EditorsTable Subrequest] The protocol server returns results based on the following conditions: 
                        Depending on the type of error, the ErrorCode is returned as an attribute of the SubResponse element.");

                Site.Assert.AreEqual<ErrorCodeType>(
                    ErrorCodeType.Success,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(subResponseJoin.ErrorCode, this.Site),
                    @"[In EditorsTableSubResponseType][ErrorCode] The protocol server sets the value of the ErrorCode attribute to ""Success"" if the protocol server succeeds in processing the editors table subrequest.");

                Site.Assert.IsNotNull(
                    subResponseJoin.SubResponseData,
                    @"[In EditorsTableSubResponseType] As part of processing the editors table subrequest, the SubResponseData element MUST be sent as part of the SubResponse element in a cell storage service response message if the following condition is true: The ErrorCode attribute that is part of the SubResponse element is set to a value of ""Success"".");
            }

            this.StatusManager.RecordEditorTable(this.DefaultFileUrl, join.SubRequestData.ClientID);

            // Call protocol adapter operation CellStorageRequest using user02 to join the editing session.
            this.InitializeContext(this.DefaultFileUrl, this.UserName02, this.Password02, this.Domain);
            join = SharedTestSuiteHelper.CreateEditorsTableSubRequestForJoinSession(System.Guid.NewGuid().ToString(), 3600);
            cellStorageResponseJoin = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { join });
            subResponseJoin = SharedTestSuiteHelper.ExtractSubResponse<EditorsTableSubResponseType>(cellStorageResponseJoin, 0, 0, this.Site);
            this.Site.Assert.AreEqual<ErrorCodeType>(
                        ErrorCodeType.Success,
                        SharedTestSuiteHelper.ConvertToErrorCodeType(subResponseJoin.ErrorCode, this.Site),
                        "Test case cannot continue unless the user {0} join the editors table succeeds",
                        this.UserName02);
            this.StatusManager.RecordEditorTable(this.DefaultFileUrl, join.SubRequestData.ClientID, this.UserName02, this.Password02, this.Domain);
            string secondClientId = join.SubRequestData.ClientID;

            EditorsTable editorsTable = this.FetchEditorTable(this.DefaultFileUrl);
            Editor editor1 = this.FindEditorById(editorsTable, firstClientId);
            Editor editor2 = this.FindEditorById(editorsTable, secondClientId);

            this.Site.Assert.IsNotNull(
                        editor1,
                        "For the requirement MS-FSSHTTP_R693, the client id {0} should exist in the editor table.",
                        firstClientId);

            this.Site.Assert.IsNotNull(
                        editor2,
                        "For the requirement MS-FSSHTTP_R693, the client id {0} should exist in the editor table.",
                        secondClientId);

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1982
                Site.CaptureRequirement(
                         "MS-FSSHTTP",
                         1982,
                         @"[In Join Editing Session] The protocol server processes this request[the EditorsTableRequestType attribute is set to ""JoinEditingSession""] to add an entry to the editors table associated with the coauthorable file by adding the client’s associated ClientId, Timeout, and AsEditor status in an entry.");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R693
                Site.CaptureRequirement(
                         "MS-FSSHTTP",
                         693,
                         @"[In SchemaLockSubRequestDataType] When more than one client is editing the file, the protocol server MUST maintain a separate timeout value for each client.");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R9001
                Site.CaptureRequirement(
                         "MS-FSSHTTP",
                         9001,
                         @"[In Appendix B: Product Behavior] Implementation does support EditorsTable operation. (Microsoft SharePoint Foundation 2013/Microsoft SharePoint Server 2013 follow this behavior.)");
            }
        }