public void Derived_Parameter_Matches(Type _, Func <Type, bool> criteria, int expectedCount) { // We do not care what the Type was, per se, but the Cases should furnish something. _.AssertNotNull(); bool TryReportParameterTypes(IEnumerable <Type> reportedTypes) { OutputHelper.WriteLine( $"Reporting {expectedCount} expected " // ReSharper disable once PossibleNullReferenceException + $"types: {Join(", ", reportedTypes.Select(x => $"'{x.FullName} : {x.BaseType.FullName}'"))}" ); return(true); } var parameterTypes = ParameterTypes.ToArray(); try { parameterTypes.Where(criteria.AssertNotNull()).AssertEqual(expectedCount, x => x.Count()) .AssertTrue(TryReportParameterTypes); } catch (Exception ex) { OutputHelper.WriteLine("Failed to verify derived Parameter matches."); parameterTypes.AssertTrue(TryReportParameterTypes); throw; } }