private static ITestMatcher <object> Matcher(object specified) { if (specified is null) { return(Matchers.BeNull()); } if (specified is ITestMatcher <object> tm) { return(tm); } var iface = specified.GetType().GetInterface(typeof(ITestMatcher <>).FullName); if (iface == null) { return(Matchers.Equal(specified)); } return((ITestMatcher <object>)TestMatcher.Adapter( iface.GetGenericArguments()[0], typeof(object), specified )); }