public void MSOXCRPC_S02_TC03_TestInvalidAsynchronousContextHandle() { this.CheckTransport(); #region Client connects with Server this.pcbAuxOut = ConstValues.ValidpcbAuxOut; this.returnValue = this.oxcrpcAdapter.EcDoConnectEx( ref this.pcxh, TestSuiteBase.UlIcxrLinkForNoSessionLink, ref this.pulTimeStamp, null, this.userDN, ref this.pcbAuxOut, this.rgwClientVersion, out this.rgwBestVersion, out this.picxr); Site.Assert.AreEqual <uint>(0, this.returnValue, "EcDoConnectEx should succeed, and send Session Context Handle (CXH) to EcDoAsyncConnectEx for testing EcDoAsyncWaitEx. '0' is expected to be returned. The returned value is {0}.", this.returnValue); #endregion #region Call EcDoRpcExt2 method with RopLogon as rgbIn // Parameter inObjHandle is no use for RopLogon command, so set it to unUsedInfo. this.rgbIn = AdapterHelper.ComposeRgbIn(ROPCommandType.RopLogon, this.unusedInfo, this.userPrivilege); this.pcbOut = ConstValues.ValidpcbOut; this.pcbAuxOut = ConstValues.ValidpcbAuxOut; this.returnValue = this.oxcrpcAdapter.EcDoRpcExt2( ref this.pcxh, PulFlags.NoCompression | PulFlags.NoXorMagic, this.rgbIn, ref this.pcbOut, null, ref this.pcbAuxOut, out this.response, ref this.responseSOHTable); Site.Assert.AreEqual <uint>(0, this.returnValue, "RopLogon should succeed and '0' is expected to be returned. The returned value is {0}.", this.returnValue); RopLogonResponse logonResponse = (RopLogonResponse)this.response; Site.Assert.AreEqual <uint>(0, logonResponse.ReturnValue, "RopLogon should succeed and 0 is expected to be returned. The returned value is {0}.", logonResponse.ReturnValue); this.objHandle = this.responseSOHTable[TestSuiteBase.FIRST][logonResponse.OutputHandleIndex]; #endregion #region Call EcDoAsyncConnectEx this.returnValue = this.oxcrpcAdapter.EcDoAsyncConnectEx(this.pcxh, ref this.pacxh); Site.Assert.AreEqual <uint>(0, this.returnValue, "EcDoAsyncConnectEx should succeed and sends ACXH to EcDoAsyncWaitEx. '0' is expected to be returned. The returned value is {0}.", this.returnValue); #endregion #region Register events on server this.rgbIn = AdapterHelper.ComposeRgbIn(ROPCommandType.RopRegisterNotification, this.objHandle, logonResponse.FolderIds[(int)FolderIds.InterpersonalMessage]); this.pcbOut = ConstValues.ValidpcbOut; this.pcbAuxOut = ConstValues.ValidpcbAuxOut; this.returnValue = this.oxcrpcAdapter.EcDoRpcExt2( ref this.pcxh, PulFlags.NoCompression | PulFlags.NoXorMagic, this.rgbIn, ref this.pcbOut, null, ref this.pcbAuxOut, out this.response, ref this.responseSOHTable); Site.Assert.AreEqual <uint>(0, this.returnValue, "EcDoRpcExt2 should succeed and '0' is expected to be returned. The returned value is {0}.", this.returnValue); RopRegisterNotificationResponse registerNotificationResponse = (RopRegisterNotificationResponse)this.response; Site.Assert.AreEqual <uint>(0, registerNotificationResponse.ReturnValue, "RopRegisterNotification should succeed and '0' is expected to be returned. The returned value is {0}.", registerNotificationResponse.ReturnValue); #endregion #region Client disconnects with Server this.returnValue = this.oxcrpcAdapter.EcDoDisconnect(ref this.pcxh); Site.Assert.AreEqual <uint>(0, this.returnValue, "EcDoDisconnect should succeed and CXH used for testing EcDoAsyncWaitEx should be released. '0' is expected to be returned. The returned value is {0}.", this.returnValue); #endregion #region Call EcDoAsyncWaitEx uint returnValueForEcDoAsyncWaitEx = this.oxcrpcAdapter.EcDoAsyncWaitEx(this.pacxh, out this.isNotificationPending); #endregion #region Call EcDoRpcExt2 with no ROP in rgbIn to get the notify information // Parameter inObjHandle and auxInfo are no use for null ROP command, so set them to unUsedInfo. this.rgbIn = AdapterHelper.ComposeRgbIn(ROPCommandType.WithoutRops, this.unusedInfo, this.unusedInfo); this.pcbAuxOut = ConstValues.ValidpcbAuxOut; this.pcbOut = ConstValues.ValidpcbOut; uint returnValueForEcDoRpcExt2 = this.oxcrpcAdapter.EcDoRpcExt2( ref this.pcxh, PulFlags.NoCompression | PulFlags.NoXorMagic, this.rgbIn, ref this.pcbOut, null, ref this.pcbAuxOut, out this.response, ref this.responseSOHTable); #region Capture code. // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCRPC_R1213, server returns {0} when call EcDoAsyncWaitEx, server returns {1} when call EcDoRpcExt2.", returnValueForEcDoAsyncWaitEx, returnValueForEcDoRpcExt2); // Verify MS-OXCRPC requirement: MS-OXCRPC_R1213 bool isVerifiedR1213 = returnValueForEcDoAsyncWaitEx != 0 || returnValueForEcDoRpcExt2 != 0; this.Site.CaptureRequirementIfIsTrue( isVerifiedR1213, 1213, @"[In Abstract Data Model] When the session context is destroyed, the asynchronous context handle becomes invalid and will be rejected if used."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCRPC_R1269,server returns {0} when call EcDoAsyncWaitEx, server returns {1} when call EcDoRpcExt2.", returnValueForEcDoAsyncWaitEx, returnValueForEcDoRpcExt2); // Verify MS-OXCRPC requirement: MS-OXCRPC_R1269 bool isVerifiedR1269 = returnValueForEcDoAsyncWaitEx != 0 || returnValueForEcDoRpcExt2 != 0; this.Site.CaptureRequirementIfIsTrue( isVerifiedR1269, 1269, @"[In Abstract Data Model] When the client connection is lost, the asynchronous context handle becomes invalid and will be rejected if used."); #endregion #endregion }
public void MSOXCRPC_S02_TC02_TestWithPendingEvent() { this.CheckTransport(); #region Initializes Server and Client this.returnStatus = this.oxcrpcAdapter.InitializeRPC(this.authenticationLevel, this.authenticationService, this.userName, this.password); Site.Assert.IsTrue(this.returnStatus, "The returned status is {0}. TRUE means that initializing the server and client to call EcDoAsyncWaitEx successfully, and FALSE means that initializing the server and client to call EcDoAsyncWaitEx failed.", this.returnStatus); #endregion #region Client connects with Server this.pcbAuxOut = ConstValues.ValidpcbAuxOut; this.returnValue = this.oxcrpcAdapter.EcDoConnectEx( ref this.pcxh, TestSuiteBase.UlIcxrLinkForNoSessionLink, ref this.pulTimeStamp, null, this.userDN, ref this.pcbAuxOut, this.rgwClientVersion, out this.rgwBestVersion, out this.picxr); Site.Assert.AreEqual <uint>(0, this.returnValue, "EcDoConnectEx should succeed and send Session Context Handle (CXH) to EcDoRpcExt2 for testing EcDoAsyncWaitEx. '0' is expected to be returned. The returned value is {0}.", this.returnValue); #endregion #region Call EcDoRpcExt2 method with RopLogon as rgbIn // Parameter inObjHandle is no use for RopLogon command, so set it to unUsedInfo. this.rgbIn = AdapterHelper.ComposeRgbIn(ROPCommandType.RopLogon, this.unusedInfo, this.userPrivilege); this.pcbOut = ConstValues.ValidpcbOut; this.pcbAuxOut = ConstValues.ValidpcbAuxOut; this.returnValue = this.oxcrpcAdapter.EcDoRpcExt2( ref this.pcxh, PulFlags.NoCompression | PulFlags.NoXorMagic, this.rgbIn, ref this.pcbOut, null, ref this.pcbAuxOut, out this.response, ref this.responseSOHTable); Site.Assert.AreEqual <uint>(0, this.returnValue, "EcDoRpcExt2 should succeed and '0' is expected to be returned. The returned value is {0}.", this.returnValue); RopLogonResponse logonResponse = (RopLogonResponse)this.response; Site.Assert.AreEqual <uint>(0, logonResponse.ReturnValue, "RopLogon should succeed and 0 is expected to be returned. The returned value is {0}.", logonResponse.ReturnValue); this.objHandle = this.responseSOHTable[TestSuiteBase.FIRST][logonResponse.OutputHandleIndex]; #endregion #region Call EcDoAsyncConnectEx this.returnValue = this.oxcrpcAdapter.EcDoAsyncConnectEx(this.pcxh, ref this.pacxh); Site.Assert.AreEqual <uint>(0, this.returnValue, "EcDoAsyncConnectEx should succeed and sends ACXH to EcDoAsyncWaitEx. '0' is expected to be returned. The returned value is {0}.", this.returnValue); #endregion #region Register events on server this.rgbIn = AdapterHelper.ComposeRgbIn(ROPCommandType.RopRegisterNotification, this.objHandle, logonResponse.FolderIds[(int)FolderIds.InterpersonalMessage]); this.pcbOut = ConstValues.ValidpcbOut; this.pcbAuxOut = ConstValues.ValidpcbAuxOut; this.returnValue = this.oxcrpcAdapter.EcDoRpcExt2( ref this.pcxh, PulFlags.NoCompression | PulFlags.NoXorMagic, this.rgbIn, ref this.pcbOut, null, ref this.pcbAuxOut, out this.response, ref this.responseSOHTable); Site.Assert.AreEqual <uint>(0, this.returnValue, "EcDoRpcExt2 should succeed and '0' is expected to be returned. The returned value is {0}.", this.returnValue); RopRegisterNotificationResponse registerNotificationResponse = (RopRegisterNotificationResponse)this.response; Site.Assert.AreEqual <uint>(0, registerNotificationResponse.ReturnValue, "RopRegisterNotification should succeed and 0 is expected to be returned. The returned value is {0}.", registerNotificationResponse.ReturnValue); #endregion #region Call EcDoAsyncWaitEx // Trigger the event bool isCreateMailSuccess = this.oxcrpcControlAdapter.CreateMailItem(); Site.Assert.IsTrue(isCreateMailSuccess, "CreateMailItem method should execute successfully."); this.returnValue = this.oxcrpcAdapter.EcDoAsyncWaitEx(this.pacxh, out this.isNotificationPending); Site.Assert.AreEqual <uint>(0, this.returnValue, @"EcDoAsyncWaitEx should succeed to check whether the NotificationPending flag is set in the pulFlagsOut field, on AsyncEMSMDB method if an event is pending. '0' is expected to be returned. The returned value is {0}.", this.returnValue); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCRPC_R1231, there are {0} pending events for the client on the Session Context on the server.", this.isNotificationPending ? string.Empty : "not"); // Verify MS-OXCRPC requirement: MS-OXCRPC_R1231 Site.CaptureRequirementIfIsTrue( this.isNotificationPending, 1231, @"[In EcDoAsyncWaitEx Method (opnum 0)] If an event is pending, the server completes the call immediately and returns the NotificationPending flag in the pulFlagsOut parameter."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCRPC_R19"); // Verify MS-OXCRPC requirement: MS-OXCRPC_R19 // Because client can use the asynchronous context handle to call EcDoAsyncWaitEx method successful. // So R19 will be verified. this.Site.CaptureRequirementIfAreEqual <uint>( 0, this.returnValue, 19, @"[In ACXH Data Type] The AXCH data type is an asynchronous context handle to be used with an AsyncEMSMDB interface, as specified in section 3.3 and section 3.4."); #endregion #region Call EcDoRpcExt2 with no ROP in rgbIn to get the notify information // Parameter inObjHandle and auxInfo are no use for null ROP command, so set them to unUsedInfo. this.rgbIn = AdapterHelper.ComposeRgbIn(ROPCommandType.WithoutRops, this.unusedInfo, this.unusedInfo); this.pcbAuxOut = ConstValues.ValidpcbAuxOut; this.pcbOut = ConstValues.ValidpcbOut; this.returnValue = this.oxcrpcAdapter.EcDoRpcExt2( ref this.pcxh, PulFlags.NoCompression | PulFlags.NoXorMagic, this.rgbIn, ref this.pcbOut, null, ref this.pcbAuxOut, out this.response, ref this.responseSOHTable); Site.Assert.AreEqual <uint>(0, this.returnValue, @"EcDoRpcExt2 should succeed to get the RopNotifyResponse. '0' is expected to be returned. The returned value is {0}.", this.returnValue); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCRPC_R1243, the ROP response is {0}", (RopNotifyResponse)this.response); // Verify MS-OXCRPC requirement: MS-OXCRPC_R1243 // According to the Open Specification MS-OXCNOTIF, the event details are in the RopNotifyResponse. If the rgbOut can be converted (parsed) to RopNotifyResponse, this requirement will be verified. Site.CaptureRequirementIfIsNotNull( (RopNotifyResponse)this.response, 1243, @"[In EcDoAsyncWaitEx Method (opnum 0)] [pulFlagsOut] [Flag NotificationPending] The server will return the event details in the ROP response buffer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCRPC_R1229, the ROP response is {0}", (RopNotifyResponse)this.response); // Verify MS-OXCRPC requirement: MS-OXCRPC_R1229 // If the response of method EcDoRpcExt2 is not null, it indicates that method EcDoAsyncWaitEx have been completed because server will return the event details in the ROP response buffer. Site.CaptureRequirementIfIsNotNull( (RopNotifyResponse)this.response, 1229, @"[In EcDoAsyncWaitEx Method (opnum 0)] The EcDoAsyncWaitEx method is an asynchronous call that the server does not complete until events are pending on the Session Context, up to a 5-minute duration of no client activity."); #endregion #region Client disconnects with Server this.returnValue = this.oxcrpcAdapter.EcDoDisconnect(ref this.pcxh); Site.Assert.AreEqual <uint>(0, this.returnValue, "EcDoDisconnect should succeed and CXH used for testing EcDoAsyncWaitEx should be released. '0' is expected to be returned. The returned value is {0}.", this.returnValue); #endregion }