private object Create(Type[] typesToProxy, object[] constructorArguments, SubstituteConfig config) { var substituteState = _substituteStateFactory.Create(config, this); var callRouter = _callRouterFactory.Create(substituteState); var primaryProxyType = GetPrimaryProxyType(typesToProxy); var additionalTypes = typesToProxy.Where(x => x != primaryProxyType).ToArray(); var proxy = _proxyFactory.GenerateProxy(callRouter, primaryProxyType, additionalTypes, constructorArguments); return(proxy); }
private object Create(Type[] typesToProxy, object[] constructorArguments, bool callBaseByDefault) { var substituteState = _substituteStateFactory.Create(this); substituteState.CallBaseConfiguration.CallBaseByDefault = callBaseByDefault; var primaryProxyType = GetPrimaryProxyType(typesToProxy); var canConfigureBaseCalls = callBaseByDefault || CanCallBaseImplementation(primaryProxyType); var callRouter = _callRouterFactory.Create(substituteState, canConfigureBaseCalls); var additionalTypes = typesToProxy.Where(x => x != primaryProxyType).ToArray(); var proxy = _proxyFactory.GenerateProxy(callRouter, primaryProxyType, additionalTypes, constructorArguments); return(proxy); }