tests/Kingdom.OrTools.Sat.Parameters.Tests/OrToolsSatParametersTests.cs
/// <summary>
/// Verifies that the Derived <see cref="Parameter"/> Types Match the <paramref name="criteria"/>.
/// </summary>
/// <param name="_">A furnished Type which further informs the nature of the Test Case.</param>
/// <param name="criteria">Anonymous Criteria used in order to filter the Parameter Types.</param>
/// <param name="expectedCount">The Expected number of Parameter Types matching the Criteria.</param>
Verifies that the Derived  Types Match the .
Verifies that the Derived Types Match the .
[Theory, MemberData(nameof(ParameterCriteria))]
        public void Derived_Parameter_Matches(Type _, Func<Type, bool> criteria, int expectedCount)
        {
            _.AssertNotNull();
            bool TryReportParameterTypes(IEnumerable<Type> reportedTypes)
            {
                OutputHelper.WriteLine(
                    $"Reporting {expectedCount} expected "
                    + $"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;
            }
        }
[ Theory , MemberData ( nameof ( ParameterCriteria ) ) ] public void Derived_Parameter_Matches ( Type _ , Func < Type , bool > criteria , int expectedCount ) { _ . AssertNotNull ( ) ; bool TryReportParameterTypes ( IEnumerable < Type > reportedTypes ) { OutputHelper . WriteLine ( $" Reporting  { expectedCount }  expected  " + $" 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 ( " " ) ; parameterTypes . AssertTrue ( TryReportParameterTypes ) ; throw ; } }
Verifies that the Derived  Types Match the .
Verifies that the Derived Types Match the .
// We do not care what the Type was, per se, but the Cases should furnish something. // ReSharper disable once PossibleNullReferenceException
_
Type
A furnished Type which further informs the nature of the Test Case.
A furnished Type which further informs the nature of the Test Case .
criteria
Func<Type, bool>
Anonymous Criteria used in order to filter the Parameter Types.
Anonymous Criteria used in order to filter the Parameter Types .
expectedCount
int
The Expected number of Parameter Types matching the Criteria.
The Expected number of Parameter Types matching the Criteria .