Microsoft.Protocols.TestSuites.MS_OXCMAPIHTTP.S02_RequestTypesForAddressBookServerEndpoint.MSOXCMAPIHTTP_S02_TC07_UpdateStat C# (CSharp) Method

MSOXCMAPIHTTP_S02_TC07_UpdateStat() private method

private MSOXCMAPIHTTP_S02_TC07_UpdateStat ( ) : void
return void
        public void MSOXCMAPIHTTP_S02_TC07_UpdateStat()
        {
            this.CheckMapiHttpIsSupported();

            #region Call Bind request type to established a session context with the address book server.
            this.Bind();
            #endregion

            #region Call UpdateStat to update the STAT structure to reflect the client's changes.
            STAT stat = new STAT();
            stat.InitiateStat();
            int delta = 1;
            stat.Delta = delta;

            UpdateStatRequestBody updateStatRequestBody = this.BuildUpdateStatRequestBody(true, stat, true);
            UpdateStatResponseBody updateStatResponseBody = this.Adapter.UpdateStat(updateStatRequestBody);
            Site.Assert.AreEqual<uint>(0, updateStatResponseBody.ErrorCode, "UpdateStat should succeed and 0 is expected to be returned. The returned value is {0}.", updateStatResponseBody.ErrorCode);

            #region Capture code
            // Add the debug information
            this.Site.Log.Add(
                LogEntryKind.Debug,
                "Verify MS-OXCMAPIHTTP_R1059. After calling UpdateStat, the value of each field (CodePage, ContainerID, CurrentRec, Delta, NumPos, SortLocale, SortType, TemplateLocale, TotalRecs)"
                + "in STAT structures is {0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}.",
                 updateStatResponseBody.State.Value.CodePage,
                 updateStatResponseBody.State.Value.ContainerID,
                 updateStatResponseBody.State.Value.CurrentRec,
                 updateStatResponseBody.State.Value.Delta,
                 updateStatResponseBody.State.Value.NumPos,
                 updateStatResponseBody.State.Value.SortLocale,
                 updateStatResponseBody.State.Value.SortType,
                 updateStatResponseBody.State.Value.TemplateLocale,
                 updateStatResponseBody.State.Value.TotalRecs);

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1059
            bool isVerifiedR1059 = stat.CodePage != updateStatResponseBody.State.Value.CodePage ||
                stat.ContainerID != updateStatResponseBody.State.Value.ContainerID ||
                stat.CurrentRec != updateStatResponseBody.State.Value.CurrentRec ||
                stat.Delta != updateStatResponseBody.State.Value.Delta ||
                stat.NumPos != updateStatResponseBody.State.Value.NumPos ||
                stat.SortLocale != updateStatResponseBody.State.Value.SortLocale ||
                stat.SortType != updateStatResponseBody.State.Value.SortType ||
                stat.TemplateLocale != updateStatResponseBody.State.Value.TemplateLocale ||
                stat.TotalRecs != updateStatResponseBody.State.Value.TotalRecs;

            this.Site.CaptureRequirementIfIsTrue(
                isVerifiedR1059,
                1059,
                @"[In UpdateStat Request Type] The UpdateStat request type is used by the client to update the STAT structure ([MS-OXNSPI] section 2.3.7) to reflect the client's changes.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1083");

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1083
            this.Site.CaptureRequirementIfAreEqual<int>(
                delta,
                updateStatResponseBody.Delta.Value,
                1083,
                @"[In UpdateStat Request Type Success Response Body] Delta: A signed integer that specifies the movement within the address book container that was specified in the State field of the request.");
            #endregion
            #endregion

            #region Call UpdateStat with HasState field set to false and DeltaRequested set to true.
            UpdateStatRequestBody updateStatRequestBody1 = this.BuildUpdateStatRequestBody(false, stat, true);
            UpdateStatResponseBody updateStatResponseBody1 = this.Adapter.UpdateStat(updateStatRequestBody1);
            Site.Assert.AreEqual<uint>(0, updateStatResponseBody1.StatusCode, "UpdateStat should succeed and 0 is expected to be returned. The returned value is {0}.", updateStatResponseBody1.StatusCode);
            #endregion

            #region Call UpdateStat with fields HasState and DeltaRequested set to false.
            UpdateStatRequestBody updateStatRequestBody2 = this.BuildUpdateStatRequestBody(false, stat, false);
            UpdateStatResponseBody updateStatResponseBody2 = this.Adapter.UpdateStat(updateStatRequestBody2);
            Site.Assert.AreEqual<uint>(0, updateStatResponseBody2.StatusCode, "UpdateStat should succeed and 0 is expected to be returned. The returned value is {0}.", updateStatResponseBody2.StatusCode);
            #endregion

            #region Call UpdateStat with HasState field set to true and DeltaRequested set to false.
            UpdateStatRequestBody updateStatRequestBody3 = this.BuildUpdateStatRequestBody(true, stat, false);
            UpdateStatResponseBody updateStatResponseBody3 = this.Adapter.UpdateStat(updateStatRequestBody3);
            Site.Assert.AreEqual<uint>(0, updateStatResponseBody3.StatusCode, "UpdateStat should succeed and 0 is expected to be returned. The returned value is {0}.", updateStatResponseBody3.StatusCode);
            #endregion

            #region Call the Unbind request type to destroy the session context.
            this.Unbind();
            #endregion
        }