Microsoft.Protocols.TestSuites.MS_OXCPRPT.MS_OXCPRPTAdapter.VerifyRopCopyToStream C# (CSharp) Method

VerifyRopCopyToStream() private method

Verify the RopCopyToStream operation related requirements.
private VerifyRopCopyToStream ( RopCopyToStreamResponse ropCopyToStreamResponse, bool isDestinationExist, bool isCopyRightDataCount, bool destHandleIsRight ) : void
ropCopyToStreamResponse Microsoft.Protocols.TestSuites.Common.RopCopyToStreamResponse The RopCopyToStream response buffer structure.
isDestinationExist bool A boolean value indicates if the destination object exists or not
isCopyRightDataCount bool Indicates if the number of properties to be copied is right or not.
destHandleIsRight bool Indicates if the DestHandleIndex is right or not.
return void
        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)");
                }
            }
        }
        #endregion
MS_OXCPRPTAdapter