protected virtual TClock ChangeClock(TClock clock, object obj, ChangeType change, IEnumerable <Type> types, params object[] args) { Assert.That(clock, Is.Not.Null); lock (clock) { var clockType = typeof(TClock); var flags = BindingFlags.Public | (ReferenceEquals(obj, null) ? BindingFlags.Static : BindingFlags.Instance); var methodName = change.GetMethodName(); var methodInfo = clockType.GetMethod(methodName, flags, Type.DefaultBinder, types.ToArray(), null); Assert.That(methodInfo, Is.Not.Null); Console.WriteLine("Changing clock with: {0}", methodInfo); methodInfo.Invoke(obj, args); return(clock); } }