/// <summary> /// Initializes the managed adapter. /// This method can be overridden by extenders to do special initialization code. /// It calls base class's Initialize method to ensure the test site is initialized. /// </summary> /// <param name="targetMethod">The method the caller invoked.</param> /// <param name="args">The arguments the caller passed to the method.</param> /// <returns>The return value of the Initialize implementation.</returns> protected override object Initialize(MethodInfo targetMethod, object[] args) { base.Initialize(targetMethod, args); TestSite.Log.Add(LogEntryKind.Comment, String.Format("Adapter {0} implements {1}", trueType.FullName, ProxyType.FullName)); TestSite.Log.Add(LogEntryKind.EnterAdapter, "Managed adapter: {0}, method: {1}", ProxyType.Name, targetMethod.Name); try { instance.Initialize((ITestSite)args[0]); } catch (Exception ex) { TestSite.Log.Add(LogEntryKind.Debug, ex.ToString()); throw; } finally { TestSite.Log.Add(LogEntryKind.ExitAdapter, "Managed adapter: {0}, method: {1}", ProxyType.Name, targetMethod.Name); } return(null); }
/// <summary> /// Initializes the managed adapter. /// This method can be overridden by extenders to do special initialization code. /// It calls base class's Initialize method to ensure the test site is initialized. /// </summary> /// <param name="methodCall"></param> /// <returns></returns> protected override IMessage Initialize(IMethodCallMessage methodCall) { base.Initialize(methodCall); TestSite.Log.Add(LogEntryKind.Comment, String.Format("Adapter {0} implements {1}", trueType.FullName, ProxyType.FullName)); TestSite.Log.Add(LogEntryKind.EnterAdapter, "Managed adapter: {0}, method: {1}", ProxyType.Name, methodCall.MethodName); try { instance.Initialize((ITestSite)methodCall.Args[0]); } catch (Exception ex) { TestSite.Log.Add(LogEntryKind.Debug, ex.ToString()); throw; } finally { TestSite.Log.Add(LogEntryKind.ExitAdapter, "Managed adapter: {0}, method: {1}", ProxyType.Name, methodCall.MethodName); } return(new ReturnMessage(null, null, 0, methodCall.LogicalCallContext, methodCall)); }