public void OutComplexValueType() { RecordingHandler handler = new RecordingHandler(); MethodBase method = typeof(SpyOut).GetMethod("OutComplexValueType"); Dictionary <MethodBase, List <IInterceptionHandler> > dictionary = new Dictionary <MethodBase, List <IInterceptionHandler> >(); List <IInterceptionHandler> handlers = new List <IInterceptionHandler>(); handlers.Add(handler); dictionary.Add(method, handlers); SpyOut result = WrapAndCreateType <SpyOut>(dictionary); ComplexValueType outValue; result.OutComplexValueType(out outValue); Assert.Equal(byte.MaxValue, outValue.Byte); Assert.Equal('a', outValue.Char); Assert.Equal(decimal.MaxValue, outValue.Decimal); Assert.Equal(double.MaxValue, outValue.Double); Assert.Equal(float.MaxValue, outValue.Float); Assert.Equal(int.MaxValue, outValue.Int); Assert.Equal(long.MaxValue, outValue.Long); Assert.Equal(short.MaxValue, outValue.Short); Assert.Equal("Hello, world!", outValue.String); Assert.Equal(uint.MaxValue, outValue.UInt); Assert.Equal(ulong.MaxValue, outValue.ULong); Assert.Equal(ushort.MaxValue, outValue.UShort); }
public void OutReferenceType() { RecordingHandler handler = new RecordingHandler(); MethodBase method = typeof(SpyOut).GetMethod("OutReferenceType"); Dictionary <MethodBase, List <IInterceptionHandler> > dictionary = new Dictionary <MethodBase, List <IInterceptionHandler> >(); List <IInterceptionHandler> handlers = new List <IInterceptionHandler>(); handlers.Add(handler); dictionary.Add(method, handlers); SpyOut result = WrapAndCreateType <SpyOut>(dictionary); string outReference; result.OutReferenceType(out outReference); Assert.Equal("Hello, world!", outReference); }
public void OutInt64() { RecordingHandler handler = new RecordingHandler(); MethodBase method = typeof(SpyOut).GetMethod("OutInt64"); Dictionary <MethodBase, List <IInterceptionHandler> > dictionary = new Dictionary <MethodBase, List <IInterceptionHandler> >(); List <IInterceptionHandler> handlers = new List <IInterceptionHandler>(); handlers.Add(handler); dictionary.Add(method, handlers); SpyOut result = WrapAndCreateType <SpyOut>(dictionary); long outValue; result.OutInt64(out outValue); Assert.Equal(long.MaxValue, outValue); }