Shim to wrap objects for ducking.
More...
|
| ShimSham (object[] toWrap, Type interfaceToMimic, bool isFuzzy, bool allowReadonlyDefaultMembers) |
| Constructs a new instance of the ShimSham with a DefaultPropertyInfoFetcher.
|
| ShimSham (object toWrap, Type interfaceToMimic, bool isFuzzy, bool allowReadonlyDefaultMembers) |
| Constructs a new instance of the ShimSham with the provided property info fetcher.
|
| ShimSham (object[] toWrap, Type interfaceToMimic, bool isFuzzy, bool allowReadonlyDefaultsForMissingMembers, IPropertyInfoFetcher propertyInfoFetcher) |
| Constructs a new instance of the ShimSham with the provided property info fetcher.
|
object | GetPropertyValue (string propertyName) |
| Gets a property value from the underlying object.- Parameters
-
propertyName | Name of the property to get the value for |
- Returns
- Value of the underlying property
|
void | SetPropertyValue (string propertyName, object newValue) |
| Sets a property value on the underlying object.- Parameters
-
propertyName | Name of the property to set |
newValue | Value to set |
|
void | CallThroughVoid (string methodName, params object[] parameters) |
| Calls through to an underlying void-returning method.- Parameters
-
methodName | Name of the method to call through to |
parameters | Parameters to pass through to the method |
|
object | CallThrough (string methodName, object[] arguments) |
| Calls through to an underlying method and returns the result.- Parameters
-
methodName | Name of the method to call through to |
arguments | Parameters to pass through to the method |
- Returns
- Value returned from the underlying method
|
|
static object | GetDefaultValueFor (Type correctType) |
| Gets the default value for a type.
|
object | ConvertWith (IConverter converter, object propValue, Type toType) |
| Converts a property value from original type to another type using the provided converter.
|
Type | MakeTypeToImplement (Type type, bool isFuzzy) |
| Creates a new type to implement the requested interface type Used internally when fleshing out non-primitive properties.
|
Shim to wrap objects for ducking.
◆ ShimSham() [1/3]
PeanutButter.DuckTyping.Shimming.ShimSham.ShimSham |
( |
object[] | toWrap, |
|
|
Type | interfaceToMimic, |
|
|
bool | isFuzzy, |
|
|
bool | allowReadonlyDefaultMembers ) |
Constructs a new instance of the ShimSham with a DefaultPropertyInfoFetcher.
- Parameters
-
toWrap | Objects to wrap (wip: only the first object is considered) |
interfaceToMimic | Interface type to mimick |
isFuzzy | Flag allowing or preventing approximation |
allowReadonlyDefaultMembers | allows properties with no backing to be read as the default value for that type |
◆ ShimSham() [2/3]
PeanutButter.DuckTyping.Shimming.ShimSham.ShimSham |
( |
object | toWrap, |
|
|
Type | interfaceToMimic, |
|
|
bool | isFuzzy, |
|
|
bool | allowReadonlyDefaultMembers ) |
Constructs a new instance of the ShimSham with the provided property info fetcher.
- Parameters
-
toWrap | Object to wrap |
interfaceToMimic | Interface type to mimick |
isFuzzy | Flag allowing or preventing approximation |
- Exceptions
-
ArgumentNullException | Thrown if the mimick interface or property info fetch are null |
- Parameters
-
allowReadonlyDefaultMembers | allows properties with no backing to be read as the default value for that type |
◆ ShimSham() [3/3]
PeanutButter.DuckTyping.Shimming.ShimSham.ShimSham |
( |
object[] | toWrap, |
|
|
Type | interfaceToMimic, |
|
|
bool | isFuzzy, |
|
|
bool | allowReadonlyDefaultsForMissingMembers, |
|
|
IPropertyInfoFetcher | propertyInfoFetcher ) |
Constructs a new instance of the ShimSham with the provided property info fetcher.
- Parameters
-
toWrap | Objects to wrap (wip: only the first object is considered) |
interfaceToMimic | Interface type to mimick |
isFuzzy | Flag allowing or preventing approximation |
allowReadonlyDefaultsForMissingMembers | Whether to allow returning default(T) for properties which are missing on the wrapped source(s) |
propertyInfoFetcher | Utility to fetch property information from the provided object and interface type |
- Exceptions
-
ArgumentNullException | Thrown if the mimick interface or property info fetch are null |
◆ CallThrough()
object PeanutButter.DuckTyping.Shimming.ShimSham.CallThrough |
( |
string | methodName, |
|
|
object[] | arguments ) |
Calls through to an underlying method and returns the result.
- Parameters
-
methodName | Name of the method to call through to |
arguments | Parameters to pass through to the method |
- Returns
- Value returned from the underlying method
Implements PeanutButter.DuckTyping.Shimming.IShimSham.
◆ CallThroughVoid()
void PeanutButter.DuckTyping.Shimming.ShimSham.CallThroughVoid |
( |
string | methodName, |
|
|
params object[] | parameters ) |
Calls through to an underlying void-returning method.
- Parameters
-
methodName | Name of the method to call through to |
parameters | Parameters to pass through to the method |
Implements PeanutButter.DuckTyping.Shimming.IShimSham.
◆ GetPropertyValue()
object PeanutButter.DuckTyping.Shimming.ShimSham.GetPropertyValue |
( |
string | propertyName | ) |
|
◆ SetPropertyValue()
void PeanutButter.DuckTyping.Shimming.ShimSham.SetPropertyValue |
( |
string | propertyName, |
|
|
object | newValue ) |
The documentation for this class was generated from the following file:
- source/Utils/PeanutButter.DuckTyping/Shimming/ShimSham.cs