private object GenerateProxy(Type typeOfFake, IEnumerable <object> argumentsForConstructor)
        {
            var fakeObject = this.CreateFakeObject();

            ProxyResult result = null;

            if (argumentsForConstructor != null)
            {
                result = this.GenerateProxyWithArgumentsForConstructor(typeOfFake, argumentsForConstructor, fakeObject);
            }
            else
            {
                result = this.GenerateProxyWithoutArgumentsForConstructor(typeOfFake, fakeObject);
            }

            fakeObject.SetProxy(result);

            this.container.ConfigureFake(typeOfFake, result.Proxy);

            return(result.Proxy);
        }
Beispiel #2
0
 internal virtual void SetProxy(ProxyResult proxy)
 {
     this.Object               = proxy.Proxy;
     this.FakeObjectType       = proxy.ProxiedType;
     proxy.CallWasIntercepted += this.Proxy_CallWasIntercepted;
 }