public void CanInterceptGenericMethodOnClosedGenericType() { PostCallCountHandler handler = new PostCallCountHandler(); InterceptingGenericClass <DateTime> instance = WireupHelper.GetInterceptedInstance <InterceptingGenericClass <DateTime> >("Reverse", handler); string result = instance.Reverse(137); Assert.AreEqual("731", result); Assert.AreEqual(1, handler.CallsCompleted); }
public void CanInterceptClosedGenericType() { PostCallCountHandler handler = new PostCallCountHandler(); InterceptingGenericClass <DateTime> instance = WireupHelper.GetInterceptedInstance <InterceptingGenericClass <DateTime> >("Decorate", handler); DateTime now = DateTime.Now; string result = instance.Decorate(now); Assert.AreEqual("**" + now + "**", result); Assert.AreEqual(1, handler.CallsCompleted); }