<commit_before>﻿namespace Fixie
{
    using System;
    using System.Reflection;
    using Cli;
    using Conventions;

    /// <summary>
    /// Base class for all Fixie conventions.  Subclass Convention to customize test discovery and execution.
    /// </summary>
    public class Convention
    {
        public Convention()
        {
            Config = new Configuration();

            Classes = new ClassExpression(Config);
            Methods = new MethodExpression(Config);
            Parameters = new ParameterSourceExpression(Config);
            CaseExecution = new CaseBehaviorExpression(Config);
            FixtureExecution = new FixtureBehaviorExpression(Config);
            ClassExecution = new ClassBehaviorExpression(Config);
            HideExceptionDetails = new AssertionLibraryExpression(Config);
        }

        /// <summary>
        /// The current state describing the convention. This state can be manipulated through
        /// the other properties on Convention.
        /// </summary>
        internal Configuration Config { get; }

        /// <summary>
        /// Take the custom convention command line arguments provided to the test runner at the
        /// start of execution, and bind them to the given model.
        /// </summary>
        public TModel Options<TModel>() where TModel : class
            => CommandLine.Parse<TModel>(RunContext.ConventionArguments);

        /// <summary>
        /// Determines whether the given Type was selected as the sole
        /// item to be executed. False under normal test execution.
        /// </summary>
        public static bool IsTarget(Type type)
            => RunContext.TargetType == type;

        /// <summary>
        /// Determines whether the given MethodInfo was selected as the sole
        /// item to be executed. False under normal test execution.
        /// </summary>
        public static bool IsTarget(MethodInfo method)
            => RunContext.TargetMethod == method;

        /// <summary>
        /// Defines the set of conditions that describe which classes are test classes.
        /// </summary>
        public ClassExpression Classes { get; }

        /// <summary>
        /// Defines the set of conditions that describe which test class methods are test methods.
        /// </summary>
        public MethodExpression Methods { get; }

        /// <summary>
        /// Defines the set of parameter sources, which provide inputs to parameterized test methods.
        /// </summary>
        public ParameterSourceExpression Parameters { get; }

        /// <summary>
        /// Customizes the execution of each test case.
        /// </summary>
        public CaseBehaviorExpression CaseExecution { get; }

        /// <summary>
        /// Customizes the execution of each test fixture (test class instance).
        /// </summary>
        public FixtureBehaviorExpression FixtureExecution { get; }

        /// <summary>
        /// Customizes the execution of each test class.
        /// </summary>
        public ClassBehaviorExpression ClassExecution { get; }

        /// <summary>
        /// Defines the set of types which make up an assertion library, so that test case failure stack
        /// traces can be simplified for readability.
        /// </summary>
        public AssertionLibraryExpression HideExceptionDetails { get; }
    }
}<commit_msg>Remove deprecated Convention.Options<TModel>() now that conventions can simply inject their TModel.<commit_after>﻿namespace Fixie
{
    using System;
    using System.Reflection;
    using Cli;
    using Conventions;

    /// <summary>
    /// Base class for all Fixie conventions.  Subclass Convention to customize test discovery and execution.
    /// </summary>
    public class Convention
    {
        public Convention()
        {
            Config = new Configuration();

            Classes = new ClassExpression(Config);
            Methods = new MethodExpression(Config);
            Parameters = new ParameterSourceExpression(Config);
            CaseExecution = new CaseBehaviorExpression(Config);
            FixtureExecution = new FixtureBehaviorExpression(Config);
            ClassExecution = new ClassBehaviorExpression(Config);
            HideExceptionDetails = new AssertionLibraryExpression(Config);
        }

        /// <summary>
        /// The current state describing the convention. This state can be manipulated through
        /// the other properties on Convention.
        /// </summary>
        internal Configuration Config { get; }

        /// <summary>
        /// Determines whether the given Type was selected as the sole
        /// item to be executed. False under normal test execution.
        /// </summary>
        public static bool IsTarget(Type type)
            => RunContext.TargetType == type;

        /// <summary>
        /// Determines whether the given MethodInfo was selected as the sole
        /// item to be executed. False under normal test execution.
        /// </summary>
        public static bool IsTarget(MethodInfo method)
            => RunContext.TargetMethod == method;

        /// <summary>
        /// Defines the set of conditions that describe which classes are test classes.
        /// </summary>
        public ClassExpression Classes { get; }

        /// <summary>
        /// Defines the set of conditions that describe which test class methods are test methods.
        /// </summary>
        public MethodExpression Methods { get; }

        /// <summary>
        /// Defines the set of parameter sources, which provide inputs to parameterized test methods.
        /// </summary>
        public ParameterSourceExpression Parameters { get; }

        /// <summary>
        /// Customizes the execution of each test case.
        /// </summary>
        public CaseBehaviorExpression CaseExecution { get; }

        /// <summary>
        /// Customizes the execution of each test fixture (test class instance).
        /// </summary>
        public FixtureBehaviorExpression FixtureExecution { get; }

        /// <summary>
        /// Customizes the execution of each test class.
        /// </summary>
        public ClassBehaviorExpression ClassExecution { get; }

        /// <summary>
        /// Defines the set of types which make up an assertion library, so that test case failure stack
        /// traces can be simplified for readability.
        /// </summary>
        public AssertionLibraryExpression HideExceptionDetails { get; }
    }
}
{'fraction_non_alphanumeric': 0.08994790070487281, 'fraction_numerical': 0.0, 'mean_word_length': 2.017568192325474, 'pattern_counts': {'":': 0, '<': 52, '<?xml version=': 0, '>': 57, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7114516', 'n_tokens_mistral': 1456, 'n_tokens_neox': 1399, 'n_words': 567}