public void TestContextNoException() { try { int contextEntryVal = 4; m_testInterceptorInit.RequestIntercept.ContextEntryBegin = contextEntryVal; System.Byte arg = 1; System.Byte result = m_testService.TestIncByte(arg); Assertion.AssertEquals((System.Byte)(arg + 1), result); Assertion.Assert("expected: a on out path called", m_testInterceptorInit.RequestIntercept.InvokedOnOutPath); Assertion.AssertEquals("a on in path called (reply)", InPathResult.Reply, m_testInterceptorInit.RequestIntercept.InPathResult); Assertion.Assert("expected server side: rec. svc. context on in path called", m_interceptorControl.IsReceiveSvcContextCalled()); Assertion.Assert("expected server side: rec. on in path called", m_interceptorControl.IsReceiveRequestCalled()); Assertion.AssertEquals("expected server side: send on out path called (reply)", OutPathResult.OutPathResult_Reply, m_interceptorControl.GetOutPathResult()); Assertion.Assert("service context not present", m_testInterceptorInit.RequestIntercept.HasReceivedContextElement); Assertion.AssertEquals("service context content", contextEntryVal, m_testInterceptorInit.RequestIntercept.ContextElement.TestEntry); } finally { m_testInterceptorInit.RequestIntercept.ClearInvocationHistory(); // call is not intercepted on server side m_interceptorControl.ClearInterceptorHistory(); } }
public void TestBypassServerInterceptors() { try { // call should be non-intercepted on server side m_interceptorControl.ClearInterceptorHistory(); // the following calls should be non-intercepted; special handling in interceptors Assertion.Assert("not expected: a rec. svc. context on in path called", !m_interceptorControl.IsReceiveSvcContextCalled(ServerInterceptor.ServerInterceptor_InterceptorA)); Assertion.Assert("not expected: b rec. svc. context on in path called", !m_interceptorControl.IsReceiveSvcContextCalled(ServerInterceptor.ServerInterceptor_InterceptorB)); Assertion.Assert("not expected: c rec. svc. context on in path called", !m_interceptorControl.IsReceiveSvcContextCalled(ServerInterceptor.ServerInterceptor_InterceptorC)); Assertion.Assert("not expected: a rec. on in path called", !m_interceptorControl.IsReceiveRequestCalled(ServerInterceptor.ServerInterceptor_InterceptorA)); Assertion.Assert("not expected: b rec. on in path called", !m_interceptorControl.IsReceiveRequestCalled(ServerInterceptor.ServerInterceptor_InterceptorB)); Assertion.Assert("not expected: c rec. on in path called", !m_interceptorControl.IsReceiveRequestCalled(ServerInterceptor.ServerInterceptor_InterceptorC)); Assertion.AssertEquals("a on out path shouldn't be called", OutPathResult.OutPathResult_NotCalled, m_interceptorControl.GetOutPathResult(ServerInterceptor.ServerInterceptor_InterceptorA)); Assertion.AssertEquals("b on out path shouldn't be called", OutPathResult.OutPathResult_NotCalled, m_interceptorControl.GetOutPathResult(ServerInterceptor.ServerInterceptor_InterceptorB)); Assertion.AssertEquals("c on out path shouldn't be called", OutPathResult.OutPathResult_NotCalled, m_interceptorControl.GetOutPathResult(ServerInterceptor.ServerInterceptor_InterceptorC)); } finally { // call is not intercepted on server side m_interceptorControl.ClearInterceptorHistory(); } }