Microsoft.Protocols.TestSuites.MS_ASEMAIL.S01_Email.MSASEMAIL_S01_TC10_NonBooleanRead C# (CSharp) Method

MSASEMAIL_S01_TC10_NonBooleanRead() private method

private MSASEMAIL_S01_TC10_NonBooleanRead ( ) : void
return void
        public void MSASEMAIL_S01_TC10_NonBooleanRead()
        {
            #region Call SendMail command to send the mail to recipient
            string emailSubject = Common.GenerateResourceName(Site, "subject");
            this.SendPlaintextEmail(emailSubject, string.Empty, string.Empty);
            #endregion

            #region Call Sync command with Change element to change the Read element with a boolean value
            // Calls Sync method to synchronize the email item on the server
            SyncStore syncChangeResult = this.GetSyncResult(emailSubject, this.User2Information.InboxCollectionId, null);
            Sync item = TestSuiteHelper.GetSyncAddItem(syncChangeResult, emailSubject);

            // Call Sync command with Change element to change the value of Read property
            this.UpdateEmail(this.User2Information.InboxCollectionId, syncChangeResult.SyncKey, true, item.ServerId, null, null);
            #endregion

            #region Verify requirement
            syncChangeResult = this.GetSyncResult(emailSubject, this.User2Information.InboxCollectionId, null);
            item = TestSuiteHelper.GetSyncAddItem(syncChangeResult, emailSubject);
            Site.Assert.IsNotNull(item.Email.Read, "The Read value should not be null.");

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

            // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R640
            Site.CaptureRequirementIfAreEqual<bool>(
                true,
                item.Email.Read.Value,
                640,
                @"[In Read] A value of 1 (TRUE) indicates the e-mail message has been viewed by the current recipient;");
            #endregion

            #region Calls Sync command with Change element to change the Read element with a non-boolean value
            SyncRequest invalidSyncRequest = TestSuiteHelper.CreateSyncChangeRequest(
                syncChangeResult.SyncKey,
                this.User2Information.InboxCollectionId,
                new Request.SyncCollectionChange { ServerId = item.ServerId });
            SendStringResponse syncStringResponse = this.EMAILAdapter.InvalidSync(
                invalidSyncRequest,
                "<ApplicationData><Read xmlns=\"Email\">NON_BOOL</Read></ApplicationData>",
                "</Change>");
            #endregion

            #region Verify requirement
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R643");

            // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R643
            Site.CaptureRequirementIfAreEqual<string>(
                "6",
                TestSuiteHelper.GetStatusCode(syncStringResponse.ResponseDataXML),
                643,
                @"[In Read] If a non-boolean value is used in a Sync command request ([MS-ASCMD] section 2.2.2.20), the server responds with Status element ([MS-ASCMD] section 2.2.3.167.16) value of 6 in the Sync command response ([MS-ASCMD] section 2.2.2.20).");
            #endregion
        }
        #endregion