/// <summary> /// Verify RopGetReceiveFolder Failure Response /// </summary> /// <param name="ropGetReceiveFolderResponse">The failure response of RopGetReceiveFolder request</param> /// <param name="inputHandleIndex">The field of InputHandleIndex in RopGetReceiveFolder request</param> private void VerifyRopGetReceiveFolderFailureResponse(RopGetReceiveFolderResponse ropGetReceiveFolderResponse, byte inputHandleIndex) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R160"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R160 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropGetReceiveFolderResponse.RopId.GetType(), 160, @"[In RopGetReceiveFolder ROP Failure Response Buffer] RopId (1 byte): An unsigned integer ."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R162"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R162 Site.CaptureRequirementIfAreEqual<byte>( (byte)RopId.RopGetReceiveFolder, ropGetReceiveFolderResponse.RopId, 162, @"[In RopGetReceiveFolder ROP Failure Response Buffer] RopId (1 byte): For this operation[RopGetReceiveFolder], this field[RopId (1 byte)] is set to 0x27."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R163"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R163 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropGetReceiveFolderResponse.InputHandleIndex.GetType(), 163, @"[In RopGetReceiveFolder ROP Failure Response Buffer] InputHandleIndex (1 byte): ): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R164"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R164 Site.CaptureRequirementIfAreEqual<byte>( inputHandleIndex, ropGetReceiveFolderResponse.InputHandleIndex, 164, @"[In RopGetReceiveFolder ROP Failure Response Buffer] InputHandleIndex (1 byte): This index MUST be set to the value specified in the InputHandleIndex field in the request."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R165"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R165 Site.CaptureRequirementIfAreEqual<Type>( typeof(uint), ropGetReceiveFolderResponse.ReturnValue.GetType(), 165, @"[In RopGetReceiveFolder ROP Failure Response Buffer] ReturnValue (4 bytes): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R167"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R167 Site.CaptureRequirementIfAreNotEqual<uint>( SuccessReturnValue, ropGetReceiveFolderResponse.ReturnValue, 167, @"[In RopGetReceiveFolder ROP Failure Response Buffer] ReturnValue (4 bytes): For this response[Failure Response], this field is set to a value other than 0x00000000."); }
/// <summary> /// Verify the response by sending the ROP RopGetReceiveFolder. /// </summary> /// <param name="response">The structure of ROP RopGetReceiveFolder response.</param> private void VerifyRopGetReceiveFolder(RopGetReceiveFolderResponse response) { // The return value is 0 to indicate that the response is successful. if (response.ReturnValue == 0) { if (response.MessageClass != null) { // If there is one character value in the string is not in the numeric range of 0 to 127, this value will be false. bool isASCII = Common.IsNullTerminatedASCIIStr(response.MessageClass); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCSTOR_R212"); // Verify MS-OXCSTOR requirement: MS-OXCSTOR_R212 // The method ToString is used to decode the stream with ASCII, so if the result is not null, this stream must use ASCII encoding. Site.CaptureRequirementIfIsTrue( isASCII, 212, @"[In RopGetReceiveFolder ROP Success Response Buffer] ExplicitMessageClass: The string [Contained by ExplicitMessageClass] MUST meet the following requirement: The string uses ASCII encoding."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCSTOR_R213, the length of the MessageClass is: {0}.", response.MessageClass.Length); // Verify MS-OXCSTOR requirement: MS-OXCSTOR_R213 // Check if the MessageClass string length is greater than zero and less than or equal to 255. bool isVerifyR213 = (response.MessageClass.Length > 0) && (response.MessageClass.Length <= 255); Site.CaptureRequirementIfIsTrue( isVerifyR213, 213, @"[In RopGetReceiveFolder ROP Success Response Buffer] ExplicitMessageClass: The string [Contained by ExplicitMessageClass] MUST meet the following requirement: The length (including the terminating NULL character) is greater than zero and less than or equal to 255."); // If MessageClass field only contains a terminating NULL character, ignore this requirement R214 if (response.MessageClass[0] != 0x00) { // If there is one character value in the string is not in the numeric range of 32 to 126, this value will be false. bool isValidateValue = true; // The last element in MessageClass is a terminating NULL character, so the length minus one here. for (int i = 0; i < response.MessageClass.Length - 1; i++) { byte elem = response.MessageClass[i]; // Check if each character value in the string is in the numeric range of 32 to 126 if ((elem < 32) || (elem > 126)) { isValidateValue = false; break; } } // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCSTOR_R214"); // Verify MS-OXCSTOR requirement: MS-OXCSTOR_R214 Site.CaptureRequirementIfIsTrue( isValidateValue, 214, @"[In RopGetReceiveFolder ROP Success Response Buffer] ExplicitMessageClass: The string [Contained by ExplicitMessageClass] MUST meet the following requirement: Each character value in the string is in the numeric range of 32 to 126, inclusive."); } // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCSTOR_R215"); // Verify MS-OXCSTOR requirement: MS-OXCSTOR_R215 // Check if the first byte in the byte array (response.MessageClass[0]) is not the character ".". Site.CaptureRequirementIfAreNotEqual<byte>( (byte)'.', response.MessageClass[0], 215, @"[In RopGetReceiveFolder ROP Success Response Buffer] ExplicitMessageClass: The string [Contained by ExplicitMessageClass] MUST meet the following requirement: The string does not begin with a period (""."")."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCSTOR_R216"); // Verify MS-OXCSTOR requirement: MS-OXCSTOR_R216 // Check if the last byte in the byte array (response.MessageClass[response.MessageClass.Length - 1]) is not the character ".". Site.CaptureRequirementIfAreNotEqual<byte>( (byte)'.', response.MessageClass[response.MessageClass.Length - 1], 216, @"[In RopGetReceiveFolder ROP Success Response Buffer] ExplicitMessageClass: The string [Contained by ExplicitMessageClass] MUST meet the following requirement: The string does not end with a period."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCSTOR_R217, the MessageClass is: {0}.", response.MessageClass.ToString()); // Verify MS-OXCSTOR requirement: MS-OXCSTOR_R217 bool isVerifyR217 = true; // Check if the element contained in the MessageClass buffer does not contain the adjacent period character "-". foreach (byte elem in response.MessageClass) { if (elem == (byte)'-') { isVerifyR213 = false; break; } } // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCSTOR_R217"); Site.CaptureRequirementIfIsTrue( isVerifyR217, 217, @"[In RopGetReceiveFolder ROP Success Response Buffer] ExplicitMessageClass: The string [Contained by ExplicitMessageClass] MUST meet the following requirement: The string does not contain adjacent periods."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCSTOR_R197"); // If the response can be parsed successfully and the return value is success, indicates the ROP's functionality is consistent with its description. Site.CaptureRequirement( 197, @"[In RopGetReceiveFolder ROP] This ROP [RopGetReceiveFolder] also returns the specific parent message class configured to deliver to that folder."); } } }
/// <summary> /// Verify RopGetReceiveFolder Success Response /// </summary> /// <param name="ropGetReceiveFolderResponse">The success response of RopGetReceiveFolder request</param> /// <param name="inputHandleIndex">The field of InputHandleIndex in RopGetReceiveFolder request</param> private void VerifyRopGetReceiveFolderSuccessResponse(RopGetReceiveFolderResponse ropGetReceiveFolderResponse, byte inputHandleIndex) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R148"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R148 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropGetReceiveFolderResponse.RopId.GetType(), 148, @"[In RopGetReceiveFolder ROP Success Response Buffer] RopId (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R150"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R150 Site.CaptureRequirementIfAreEqual<byte>( (byte)RopId.RopGetReceiveFolder, ropGetReceiveFolderResponse.RopId, 150, @"[In RopGetReceiveFolder ROP Success Response Buffer] RopId (1 byte): For this operation[RopGetReceiveFolder], this field[RopId (1 byte)] is set to 0x27."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R151"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R151 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropGetReceiveFolderResponse.InputHandleIndex.GetType(), 151, @"[In RopGetReceiveFolder ROP Success Response Buffer] InputHandleIndex (1 byte): An unsigned integer index."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R152"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R152 Site.CaptureRequirementIfAreEqual<byte>( inputHandleIndex, ropGetReceiveFolderResponse.InputHandleIndex, 152, @"[In RopGetReceiveFolder ROP Success Response Buffer] InputHandleIndex (1 byte): This index MUST be set to the value specified in the InputHandleIndex field in the request."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R153"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R153 Site.CaptureRequirementIfAreEqual<Type>( typeof(uint), ropGetReceiveFolderResponse.ReturnValue.GetType(), 153, @"[In RopGetReceiveFolder ROP Success Response Buffer] ReturnValue (4 bytes): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R155"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R155 Site.CaptureRequirementIfAreEqual<uint>( SuccessReturnValue, ropGetReceiveFolderResponse.ReturnValue, 155, @"[In RopGetReceiveFolder ROP Success Response Buffer] ReturnValue (4 bytes): For this response[Success Response], this field is set to 0x00000000."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R156"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R156 Site.CaptureRequirementIfAreEqual<int>( 8, Marshal.SizeOf(ropGetReceiveFolderResponse.FolderId.GetType()), 156, @"[In RopGetReceiveFolder ROP Success Response Buffer] FolderId (8 bytes): An identifier."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R158, the actual value of ExplicitMessageClass is :{0}", BitConverter.ToString(ropGetReceiveFolderResponse.MessageClass)); // Verify MS-OXCROPS requirement: MS-OXCROPS_R158 bool isVerifyR158 = this.IsNullTerminatedASCIIStr(ropGetReceiveFolderResponse.MessageClass); Site.CaptureRequirementIfIsTrue( isVerifyR158, 158, @"[In RopGetReceiveFolder ROP Success Response Buffer] ExplicitMessageClass (variable): A null-terminated ASCII string."); }