public Func <ISubstituteState, IRoute> UseNextRoute(ICallRouter callRouter)
        {
            var result = _impl.UseNextRoute(_ctx.MapToDiagRouter(callRouter));

            Trace($"UseNextRoute(callRouter: {callRouter.DiagName(_ctx)}) => {result.DiagName()}");
            return(result);
        }
Beispiel #2
0
        public object GenerateProxy(ICallRouter callRouter, Type typeToProxy, Type[] additionalInterfaces,
                                    object[] constructorArguments)
        {
            var diagCallRouter = new DiagnosticsCallRouter(callRouter, _ctx);
            var result         = _impl.GenerateProxy(diagCallRouter, typeToProxy, additionalInterfaces, constructorArguments);

            _ctx.RegisterPrimaryProxyType(result, typeToProxy);

            LogAndTrace(
                $"GenerateProxy(callRouter: {callRouter.DiagName(_ctx)}, " +
                $"typeToProxy: {typeToProxy.FullName}, " +
                $"additionalInterfaces: {additionalInterfaces.Print(x => x.FullName)}, " +
                $"constructorArguments: {constructorArguments.Print(a => a.GetObjectId(_ctx))}) " +
                $"=> {result.SubstituteId(_ctx)}");

            _ctx.MapRouterToSubstitute(callRouter, result);
            _ctx.MapRouterToSubstitute(diagCallRouter, result);
            _ctx.MapRouterToDiagRouter(callRouter, diagCallRouter);

            return(result);
        }
 public void SetNextRoute(ICallRouter callRouter, Func <ISubstituteState, IRoute> nextRouteFactory)
 {
     Trace(
         $"SetNextRoute(callRouter: {callRouter.DiagName(_ctx)}, nextRouteFactory: {nextRouteFactory.DiagName()})");
     _impl.SetNextRoute(_ctx.MapToDiagRouter(callRouter), nextRouteFactory);
 }
 public void SetLastCallRouter(ICallRouter callRouter)
 {
     Trace($"SetLastCallRouter(callRouter: {callRouter.DiagName(_ctx)})");
     _impl.SetLastCallRouter(_ctx.MapToDiagRouter(callRouter));
 }