/// <summary>
        /// Verify RopCopyToStream Null Destination Failure Response
        /// </summary>
        /// <param name="ropCopyToStreamResponse">The null destination failure response of RopCopyToStream request</param>
        /// <param name="sourceHandleIndex">The field of SourceHandleIndex in RopCopyToStream request</param>
        /// <param name="destHandleIndex">The field of DestHandleIndex in RopCopyToStream request</param>
        private void VerifyRopCopyToStreamNullDestinationFailureResponse(RopCopyToStreamResponse ropCopyToStreamResponse, byte sourceHandleIndex, uint destHandleIndex)
        {
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3392");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R3392
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(byte),
                ropCopyToStreamResponse.RopId.GetType(),
                3392,
                @"[In RopCopyToStream ROP Null Destination Failure Response Buffer]RopId (1 byte): An unsigned integer.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R3394
            Site.CaptureRequirementIfAreEqual<byte>(
                (byte)RopId.RopCopyToStream,
                ropCopyToStreamResponse.RopId,
                3394,
                @"[In RopCopyToStream ROP Null Destination Failure Response Buffer,RopId (1 byte)]For this operation[RopCopyToStream], this field is set to 0x3A.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R3395
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(byte),
                ropCopyToStreamResponse.SourceHandleIndex.GetType(),
                3395,
                @"[In RopCopyToStream ROP Null Destination Failure Response Buffer]SourceHandleIndex (1 byte): An unsigned integer.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R3396
            Site.CaptureRequirementIfAreEqual<byte>(
                sourceHandleIndex,
                ropCopyToStreamResponse.SourceHandleIndex,
                3396,
                @"[In RopCopyToStream ROP Null Destination Failure Response Buffer,SourceHandleIndex (1 byte)]This index MUST be set to the value specified in the SourceHandleIndex field in the request.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R3398
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(uint),
                ropCopyToStreamResponse.ReturnValue.GetType(),
                3398,
                @"[In RopCopyToStream ROP Null Destination Failure Response Buffer]ReturnValue (4 bytes): An unsigned integer.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R3400
            Site.CaptureRequirementIfAreEqual<uint>(
                ReturnValueForRopMoveFolderResponseAndMoveCopyMessage,
                ropCopyToStreamResponse.ReturnValue,
                3400,
                @"[In RopCopyToStream ROP Null Destination Failure Response Buffer,ReturnValue (4 bytes)]For this response[Null Destination Failure Response], this field is set to 0x00000503.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R3401
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(uint),
                ropCopyToStreamResponse.DestHandleIndex.GetType(),
                3401,
                @"[In RopCopyToStream ROP Null Destination Failure Response Buffer]DestHandleIndex (4 bytes): An unsigned integer.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R3402
            Site.CaptureRequirementIfAreEqual<uint>(
                destHandleIndex,
                ropCopyToStreamResponse.DestHandleIndex,
                3402,
                @"[In RopCopyToStream ROP Null Destination Failure Response Buffer,DestHandleIndex (4 bytes)]This index MUST be set to the specified in the DestHandleIndex field in the request.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R3404
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(ulong),
                ropCopyToStreamResponse.ReadByteCount.GetType(),
                3404,
                @"[In RopCopyToStream ROP Null Destination Failure Response Buffer]ReadByteCount (8 bytes): An unsigned integer.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R3412
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(ulong),
                ropCopyToStreamResponse.WrittenByteCount.GetType(),
                3412,
                @"[In RopCopyToStream ROP Null Destination Failure Response Buffer]WrittenByteCount (8 bytes): An unsigned integer.");

            if (Common.IsRequirementEnabled(3411, this.Site))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3411,the ReadByteCount:{0}", ropCopyToStreamResponse.ReadByteCount);

                // Verify MS-OXCROPS requirement: 3411
                Site.CaptureRequirementIfAreEqual<ulong>(
                    ReadOrWrittenByteCountForRopCopyToStream,
                    ropCopyToStreamResponse.ReadByteCount,
                    3411,
                    @"[In Appendix B: Product Behavior] For this response [of read from the source object ] , Implementation does set this field[ReadByteCount] to 0x0000000000000000. (Microsoft Exchange Server 2010 and above follow this behavior.)");
            }

            if (Common.IsRequirementEnabled(4692, this.Site))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R4692");

                // Verify MS-OXCROPS requirement: MS-OXCROPS_R4692
                Site.CaptureRequirementIfAreNotEqual<ulong>(
                    ReadOrWrittenByteCountForRopCopyToStream,
                    ropCopyToStreamResponse.ReadByteCount,
                    4692,
                    @"[In Appendix B: Product Behavior] Implementation does not set the field[ReadByteCount] to 0x0000000000000000, but the non zero value has no meaning.  (<11> Section 2.2.9.8.3: Exchange 2007 do not set the field to 0x0000000000000000, but the nonzero value has no meaning.)");
            }

            if (Common.IsRequirementEnabled(3415, this.Site))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3415,the WrittenByteCount:{0}", ropCopyToStreamResponse.WrittenByteCount);

                // Verify MS-OXCROPS requirement: 3415
                Site.CaptureRequirementIfAreEqual<ulong>(
                    ReadOrWrittenByteCountForRopCopyToStream,
                    ropCopyToStreamResponse.WrittenByteCount,
                    3415,
                    @"[In Appendix B: Product Behavior] For this response [of written to the destination object], Implementation does set this field[WrittenByteCount] to 0x0000000000000000. (Microsoft Exchange Server 2010 and above follow this behavior.)");
            }

            if (Common.IsRequirementEnabled(4693, this.Site))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R4693");

                // Verify MS-OXCROPS requirement: MS-OXCROPS_R4693
                Site.CaptureRequirementIfAreNotEqual<ulong>(
                    ReadOrWrittenByteCountForRopCopyToStream,
                    ropCopyToStreamResponse.WrittenByteCount,
                    4693,
                    @"[In Appendix B: Product Behavior] Implementation does not set the field[WrittenByteCount] to 0x0000000000000000, but the non zero value has no meaning. (<12> Section 2.2.9.8.3: Exchange 2007 do not set the field to 0x0000000000000000, but the nonzero value has no meaning.)");
            }
        }
Пример #2
0
        /// <summary>
        /// Verify the RopCopyToStream operation related requirements.
        /// </summary>
        /// <param name="ropCopyToStreamResponse">The RopCopyToStream response buffer structure.</param>
        /// <param name="isDestinationExist">A boolean value indicates if the destination object exists or not</param>
        /// <param name="isCopyRightDataCount">Indicates if the number of properties to be copied is right or not.</param>
        /// <param name="destHandleIsRight">Indicates if the DestHandleIndex is right or not.</param>
        private void VerifyRopCopyToStream(RopCopyToStreamResponse ropCopyToStreamResponse, bool isDestinationExist, bool isCopyRightDataCount, bool destHandleIsRight)
        {
            // Since the RopCopyToStream ROP response was parsed successfully, MS-OXCPRPT_R76002 can be captured directly.
            Site.CaptureRequirement(
                76002,
                @"[In Processing RopCopyToStream] The server responds with a RopCopyToStream ROP response buffer.");

            if (isDestinationExist)
            {
                Site.CaptureRequirementIfIsTrue(
                    isCopyRightDataCount,
                    34902,
                    @"[In RopCopyToStream ROP Response Buffer] WrittenByteCount: An integer that specifies the number of bytes written to the destination stream. ");
            }

            if (ropCopyToStreamResponse.ReturnValue.Equals((uint)CPRPTErrorCode.None))
            {
                // If this operation is performed successfully, that means this operation is valid on Stream objects.
                Site.CaptureRequirement(
                    34301,
                    @"[In RopCopyToStream ROP] This operation is valid on Stream objects.");

                // The parser has ensured the field satisfied the format, otherwise the response cannot be received.
                Site.CaptureRequirement(
                    35101,
                    @"[In RopCopyToStream ROP Response Buffer] DestHandleIndex (4 bytes): An integer.");

                // The parser has ensured the field satisfied the format, otherwise the response cannot be received.
                Site.CaptureRequirement(
                  34701,
                  @"[In RopCopyToStream ROP Response Buffer] ReadByteCount: 8 bytes integer.");

                // The parser has ensured the field satisfied the format, otherwise the response cannot be received.
                Site.CaptureRequirement(
                 34901,
                 @"[In RopCopyToStream ROP Response Buffer] WrittenByteCount: 8 bytes integer.");

                // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R591
                // ReadByteCount specifies the number of BYTES read from the source object while WrittenByteCount specifies the number of BYTES written to the destination object.
                // When this operation is performed successfully, if ReadByteCount equals WrittenByteCount, it means the position of destination streams is moved forward the same bytes as the source streams.
                Site.CaptureRequirementIfAreEqual<ulong>(
                    ropCopyToStreamResponse.WrittenByteCount,
                    ropCopyToStreamResponse.ReadByteCount,
                    591,
                    @"[In Processing RopCopyToStream] The server MUST move the seek pointer of both the source and destination streams forward the same number of bytes as were copied.");
            }

            if (!ropCopyToStreamResponse.ReturnValue.Equals((uint)CPRPTErrorCode.NullDestinationObject))
            {
                // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R352
                // The value of DestHandleIndex is 0 means this field is not present.
                Site.CaptureRequirementIfAreEqual<uint>(
                    0,
                    ropCopyToStreamResponse.DestHandleIndex,
                    352,
                    @"[In RopCopyToStream ROP Response Buffer] DestHandleIndex: The DestHandleIndex field MUST NOT be present if the ReturnValue field is set to any value other than NullDestinationObject (0x00000503).");
            }
            else
            {
                // The parser has ensured the field satisfied the format, otherwise the response cannot be received.
                Site.CaptureRequirementIfIsTrue(
                    destHandleIsRight,
                    351,
                    @"[In RopCopyToStream ROP Response Buffer] DestHandleIndex: The DestHandleIndex field MUST be set to the value of the DestHandleIndex field of the ROP request buffer.");
            }

            if (!isDestinationExist)
            {
                if (Common.IsRequirementEnabled(895, this.Site))
                {
                    // Verify MS-OXCPRPT requirement: MS-OXCPRPT_R895
                    Site.CaptureRequirementIfAreEqual<uint>(
                        (uint)CPRPTErrorCode.NullDestinationObject,
                        ropCopyToStreamResponse.ReturnValue,
                        895,
                        @"[In Processing RopCopyToStream] Implementation does return error code ""0x00000503"" with name ""NullDestinationObject"", when Destination object does not exist.(Microsoft Exchange Server 2007 and above follow this behavior)");
                }
            }
        }
        /// <summary>
        /// Verify RopCopyToStream Response
        /// </summary>
        /// <param name="ropCopyToStreamResponse">The response of RopCopyToStream request</param>
        /// <param name="sourceHandleIndex">The field of SourceHandleIndex in RopCopyToStream request</param>
        private void VerifyRopCopyToStreamResponse(RopCopyToStreamResponse ropCopyToStreamResponse, byte sourceHandleIndex)
        {
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3379");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R3379
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(byte),
                ropCopyToStreamResponse.RopId.GetType(),
                3379,
                @"[In RopCopyToStream ROP Response Buffer]RopId (1 byte): An unsigned integer.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R3381
            Site.CaptureRequirementIfAreEqual<byte>(
                (byte)RopId.RopCopyToStream,
                ropCopyToStreamResponse.RopId,
                3381,
                @"[In RopCopyToStream ROP Response Buffer,RopId (1 byte)]For this operation[RopCopyToStream], this field is set to 0x3A.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R3382
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(byte),
                ropCopyToStreamResponse.SourceHandleIndex.GetType(),
                3382,
                @"[In RopCopyToStream ROP Response Buffer]SourceHandleIndex (1 byte): An unsigned integer.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R3383
            Site.CaptureRequirementIfAreEqual<byte>(
                sourceHandleIndex,
                ropCopyToStreamResponse.SourceHandleIndex,
                3383,
                @"[In RopCopyToStream ROP Response Buffer,SourceHandleIndex (1 byte)]This index MUST be set to the value specified in the SourceHandleIndex field in the request.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R3385
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(uint),
                ropCopyToStreamResponse.ReturnValue.GetType(),
                3385,
                @"[In RopCopyToStream ROP Response Buffer]ReturnValue (4 bytes): An unsigned integer.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R3387
            Site.CaptureRequirementIfAreNotEqual<uint>(
                ReturnValueForRopMoveFolderResponseAndMoveCopyMessage,
                ropCopyToStreamResponse.ReturnValue,
                3387,
                @"[In RopCopyToStream ROP Response Buffer,ReturnValue (4 bytes)]For this response[except Null Destination Failure Response ], this field is set to a value other than 0x00000503.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R3388
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(ulong),
                ropCopyToStreamResponse.ReadByteCount.GetType(),
                3388,
                @"[In RopCopyToStream ROP Response Buffer]ReadByteCount (8 bytes): An unsigned integer.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R3390
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(ulong),
                ropCopyToStreamResponse.WrittenByteCount.GetType(),
                3390,
                @"[In RopCopyToStream ROP Response Buffer]WrittenByteCount (8 bytes): An unsigned integer.");
        }