internal virtual void AttachProxy(Type typeOfFake, object proxy, ICallInterceptedEventRaiser eventRaiser) { this.Object = proxy; this.FakeObjectType = typeOfFake; eventRaiser.CallWasIntercepted += this.Proxy_CallWasIntercepted; }
/// <summary> /// Attaches a <see cref="FakeManager"/> to the specified proxy, listening to /// the event raiser. /// </summary> /// <param name="typeOfFake">The type of the fake object proxy.</param> /// <param name="proxy">The proxy to attach to.</param> /// <param name="eventRaiser">The event raiser to listen to.</param> public void AttachFakeManagerToProxy(Type typeOfFake, object proxy, ICallInterceptedEventRaiser eventRaiser) { var manager = this.managerFactory.Invoke(); TagProxy(proxy, manager); manager.AttachProxy(typeOfFake, proxy, eventRaiser); }
/// <summary> /// Initializes a new instance of the <see cref="ProxyGeneratorResult"/> class. /// Creates a new instance representing a successful proxy /// generation. /// </summary> /// <param name="generatedProxy"> /// The proxy that was generated. /// </param> /// <param name="callInterceptedEventRaiser"> /// An event raiser that raises /// events when calls are intercepted to the proxy. /// </param> public ProxyGeneratorResult(object generatedProxy, ICallInterceptedEventRaiser callInterceptedEventRaiser) { Guard.AgainstNull(generatedProxy, "generatedProxy"); Guard.AgainstNull(callInterceptedEventRaiser, "callInterceptedEventRaiser"); this.ProxyWasSuccessfullyGenerated = true; this.GeneratedProxy = generatedProxy; this.CallInterceptedEventRaiser = callInterceptedEventRaiser; }
public RaisableFakeManager() { this.raiser = A.Fake <ICallInterceptedEventRaiser>(); this.AttachProxy(typeof(object), new object(), this.raiser); }