public void RefValueType() { RecordingHandler handler = new RecordingHandler(); MethodBase method = typeof(ISpyRef).GetMethod("RefValueType"); Dictionary <MethodBase, List <IInterceptionHandler> > dictionary = new Dictionary <MethodBase, List <IInterceptionHandler> >(); List <IInterceptionHandler> handlers = new List <IInterceptionHandler>(); handlers.Add(handler); dictionary.Add(method, handlers); ISpyRef result = WrapAndCreateType <ISpyRef, SpyRef>(dictionary); int refValue = 21; result.RefValueType(ref refValue); Assert.Equal(42, refValue); }
public void RefClassParameter() { RecordingHandler handler = new RecordingHandler(); MethodBase method = typeof(ISpyRef).GetMethod("RefClassParameter"); Dictionary <MethodBase, List <IInterceptionHandler> > dictionary = new Dictionary <MethodBase, List <IInterceptionHandler> >(); List <IInterceptionHandler> handlers = new List <IInterceptionHandler>(); handlers.Add(handler); dictionary.Add(method, handlers); ISpyRef result = WrapAndCreateType <ISpyRef, SpyRef>(dictionary); string refValue = "Hello, "; result.RefClassParameter(ref refValue); Assert.Equal("Hello, world!", refValue); }