public HostService( ISpy spy, Foo foo) { _spy = spy; _foo = foo; }
public void InterceptViaAttributes() { Recorder.Records.Clear(); DependencyContainer container = new DependencyContainer(); container.RegisterTypeMapping <ISpy, SpyInterfaceAttributes>(); ISpy obj = container.Get <ISpy>(); obj.InterceptedMethod(); Assert.Equal(3, Recorder.Records.Count); Assert.Equal("Before Method", Recorder.Records[0]); Assert.Equal("In Method", Recorder.Records[1]); Assert.Equal("After Method", Recorder.Records[2]); }
public void InterceptViaCode() { Recorder.Records.Clear(); DependencyContainer container = new DependencyContainer(); container.RegisterTypeMapping <ISpy, SpyInterface>(); container.InterceptInterface <SpyInterface>(typeof(ISpy).GetMethod("InterceptedMethod"), new RecordingHandler()); ISpy obj = container.Get <ISpy>(); obj.InterceptedMethod(); Assert.Equal(3, Recorder.Records.Count); Assert.Equal("Before Method", Recorder.Records[0]); Assert.Equal("In Method", Recorder.Records[1]); Assert.Equal("After Method", Recorder.Records[2]); }
public void ExceptionsAreUnchanged() { Recorder.Records.Clear(); DependencyContainer container = new DependencyContainer(); container.RegisterTypeMapping <ISpy, SpyInterface>(); container.InterceptInterface <SpyInterface>(typeof(ISpy).GetMethod("ThrowsException"), new RecordingHandler()); ISpy obj = container.Get <ISpy>(); Assert.Throws <Exception>(delegate { obj.ThrowsException(); }); Assert.Equal(3, Recorder.Records.Count); Assert.Equal("Before Method", Recorder.Records[0]); Assert.Equal("In Method", Recorder.Records[1]); Assert.Equal("After Method", Recorder.Records[2]); }
public WaitList(ISpy spy) { this.spy = spy; }
public Reservation(ISpy spy) { this.spy = spy; this.Id = Guid.NewGuid(); this.spy.Spy("Reservation ctor"); }
public RetryHandler(ISpy spy) { this.spy = spy; }
public MultipleCommandCommandHandler(ISpy spy) { this.spy = spy; }
public Order(ISpy spy) { this.spy = spy; this.Id = Guid.NewGuid(); this.spy.Spy("Order ctor"); }
static bool IsTrue(ISpy spy) { spy.Is(); return(true); }
public Foo(ISpy spy) { _spy = spy; }
public FakeEventSubscriberWithException(ISpy spy) { this.spy = spy; }
public static string Stringify(this ISpy soldier) => $"{Stringify((ISoldier) soldier)}\r\nCode Number: {soldier.CodeNumber}";
public Payment(ISpy spy) { this.spy = spy; this.Id = Guid.NewGuid(); this.spy.Spy("Payment ctor"); }
public AggregateSubscriber(ISpy spy) { this.spy = spy; }