public IDisposable SetTestHook(T testHook) { IDisposable result = new Hookable <T> .ResetTestHook(this, this.Value); this.Value = ((this.setTestHookNullRestoresDefaultValue && testHook == null) ? this.defaultValue : testHook); return(result); }
internal IDisposable SetTestHook(ITraceTestHook testHook) { if (this.testHook == null) { this.testHook = Hookable <ITraceTestHook> .Create(false, null); } return(this.testHook.SetTestHook(testHook)); }
public static Hookable <T> Create(bool setTestHookNullRestoresDefaultValue, string fieldName, Type type) { FieldInfo field = ReflectionHelper.TraverseTypeHierarchy <FieldInfo, string>(type, fieldName, new MatchType <FieldInfo, string>(ReflectionHelper.MatchStaticField)); return(Hookable <T> .Create(setTestHookNullRestoresDefaultValue, field, null)); }
public static Hookable <T> Create <TInstance>(bool setTestHookNullRestoresDefaultValue, string fieldName, TInstance instance) { FieldInfo field = ReflectionHelper.TraverseTypeHierarchy <FieldInfo, string>(typeof(TInstance), fieldName, new MatchType <FieldInfo, string>(ReflectionHelper.MatchInstanceField)); return(Hookable <T> .Create(setTestHookNullRestoresDefaultValue, field, instance)); }
public ResetTestHook(Hookable <T> parent, T oldValue) { this.disposed = false; this.oldValue = oldValue; this.parent = parent; }