Microsoft.Protocols.TestSuites.MS_OXCNOTIF.MS_OXCNOTIFAdapter.VerifyRopNotifyForNewMail C# (CSharp) Method

VerifyRopNotifyForNewMail() private method

Verify RopNotify response for NewMail events
private VerifyRopNotifyForNewMail ( RopNotifyResponse ropNotifyResponse ) : void
ropNotifyResponse RopNotifyResponse The response of ropNotify
return void
        private void VerifyRopNotifyForNewMail(RopNotifyResponse ropNotifyResponse)
        {
            if (ropNotifyResponse.NotificationData.NotificationType == NotificationType.NewMail)
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCNOTIF_R213");

                // Verify MS-OXCNOTIF requirement: MS-OXCNOTIF_R213
                this.Site.CaptureRequirementIfAreEqual<int>(
                    4,
                    Marshal.SizeOf(ropNotifyResponse.NotificationData.MessageFlags),
                    213,
                    @"[In NotificationData Structure] It [MessageFlags] is 4 bytes.");
            
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCNOTIF_R217");

                // Verify MS-OXCNOTIF requirement: MS-OXCNOTIF_R217
                this.Site.CaptureRequirementIfAreEqual<int>(
                    1,
                    Marshal.SizeOf(ropNotifyResponse.NotificationData.UnicodeFlag),
                    217,
                    @"[In NotificationData Structure] It [UnicodeFlag]  is 1 byte.");
            }

            if (ropNotifyResponse.NotificationData.MessageClass != null)
            {
                if (ropNotifyResponse.NotificationData.UnicodeFlag == 0x00)
                {
                    // Add the debug information
                    this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCNOTIF_R219");

                    // Verify MS-OXCNOTIF requirement: MS-OXCNOTIF_R219
                    bool isVerifiedR219 = this.IsNullTerminatedASCIIStr(ropNotifyResponse.NotificationData.MessageClass);

                    this.Site.CaptureRequirementIfIsTrue(
                        isVerifiedR219,
                        219,
                        @"[In NotificationData Structure]  otherwise, [the value of UnicodeFlag is]FALSE (0x00) indicates the value of the MessageClass is in ASCII.");

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

                    // Verify MS-OXCNOTIF requirement: MS-OXCNOTIF_R225
                    bool isVerifiedR225 = this.IsNullTerminatedASCIIStr(ropNotifyResponse.NotificationData.MessageClass);

                    this.Site.CaptureRequirementIfIsTrue(
                        isVerifiedR225,
                        225,
                        @"[In NotificationData Structure] The string [MessageClass] is in ASCII if UnicodeFlag is set to FALSE (0x00).");

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

                    // The requirements R225 have already verify the string type of MessageClass, 
                    // so capture it directly.
                    this.Site.CaptureRequirement(
                        223,
                        @"[In NotificationData Structure] MessageClass (variable): A null-terminated string containing the message class of the new mail.");
                }
            }
        }